RobotCore
1.0
WPILib port to raspberry Pi
Toggle main menu visibility
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
7
package
org.wpilib.system;
8
9
import
java.io.File;
10
import
java.nio.file.Path;
11
12
import
org.wpilib.framework.RobotBase;
13
21
public
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
}
org.wpilib.framework.RobotBase
Definition
RobotBase.java:53
org.wpilib.framework.RobotBase.isSimulation
static boolean isSimulation()
Definition
RobotBase.java:319
org.wpilib.system.Filesystem.getDeployDirectory
static File getDeployDirectory()
Definition
Filesystem.java:62
org.wpilib.system.Filesystem.getLaunchDirectory
static File getLaunchDirectory()
Definition
Filesystem.java:30
org.wpilib.system.Filesystem.getOperatingDirectory
static File getOperatingDirectory()
Definition
Filesystem.java:46
org
wpilib
system
Filesystem.java
Generated by
1.18.0