RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
Filesystem.java
1// TODO - Modified
2
3// Copyright (c) FIRST and other WPILib contributors.
4// Open Source Software; you can modify and/or share it under the terms of
5// the WPILib BSD license file in the root directory of this project.
6
7package org.wpilib.system;
8
9import java.io.File;
10import java.nio.file.Path;
11
12import org.wpilib.framework.RobotBase;
13
21public final class Filesystem {
22 private Filesystem() {}
23
30 public static File getLaunchDirectory() {
31 // workaround for
32 // https://www.chiefdelphi.com/t/filesystem-getdeploydirectory-returning-wrong-location-how-to-fix/427292
33 String path =
34 System.getProperty("user.dir")
35 .replace(
36 File.separator + "build" + File.separator + "jni" + File.separator + "release", "");
37 return new File(path).getAbsoluteFile();
38 }
39
46 public static File getOperatingDirectory() {
47 if (!RobotBase.isSimulation()) {
48 // System.out.println("Current folder: " + Path.of("").toAbsolutePath());
49 return new File("/robot/.remotevm/first.robot.Main"); // TODO - This really should be tied to the package name of main
50 } else {
51 return getLaunchDirectory();
52 }
53 }
54
62 public static File getDeployDirectory() {
63 if (!RobotBase.isSimulation()) {
64 return new File(getOperatingDirectory(), "deploy");
65 } else {
66 return new File(
67 getOperatingDirectory(), "src" + File.separator + "main" + File.separator + "deploy");
68 }
69 }
70}
static File getOperatingDirectory()