[wpilib] Use IsSimulation() consistently (#3534)

This commit is contained in:
Tyler Veness
2023-09-15 20:05:16 -07:00
committed by GitHub
parent 12e2043b77
commit 575348b81c
5 changed files with 21 additions and 15 deletions

View File

@@ -39,7 +39,7 @@ public final class Filesystem {
* @return The operating directory
*/
public static File getOperatingDirectory() {
if (RobotBase.isReal()) {
if (!RobotBase.isSimulation()) {
return new File("/home/lvuser");
} else {
return getLaunchDirectory();
@@ -54,7 +54,7 @@ public final class Filesystem {
* @return The 'deploy' directory
*/
public static File getDeployDirectory() {
if (RobotBase.isReal()) {
if (!RobotBase.isSimulation()) {
return new File(getOperatingDirectory(), "deploy");
} else {
return new File(

View File

@@ -74,7 +74,7 @@ public abstract class RobotBase implements AutoCloseable {
@Override
public boolean isRoboRIO() {
return RobotBase.isReal();
return !RobotBase.isSimulation();
}
};
@@ -154,7 +154,7 @@ public abstract class RobotBase implements AutoCloseable {
setupMathShared();
// subscribe to "" to force persistent values to propagate to local
m_suball = new MultiSubscriber(inst, new String[] {""});
if (isReal()) {
if (!isSimulation()) {
inst.startServer("/home/lvuser/networktables.json");
} else {
inst.startServer();
@@ -202,7 +202,7 @@ public abstract class RobotBase implements AutoCloseable {
* @return If the robot is running in simulation.
*/
public static boolean isSimulation() {
return !isReal();
return HALUtil.getHALRuntimeType() != 0;
}
/**
@@ -337,7 +337,7 @@ public abstract class RobotBase implements AutoCloseable {
m_robotCopy = robot;
m_runMutex.unlock();
if (isReal()) {
if (!isSimulation()) {
final File file = new File("/tmp/frc_versions/FRC_Lib_Version.ini");
try {
if (file.exists() && !file.delete()) {