mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Only write version information on real robot (#1510)
Writing to the versions file throws an exception on Windows, and might write weird files on Linux.
This commit is contained in:
committed by
Peter Johnson
parent
8ac4b113a5
commit
d817001259
@@ -237,23 +237,25 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final File file = new File("/tmp/frc_versions/FRC_Lib_Version.ini");
|
||||
if (isReal()) {
|
||||
try {
|
||||
final File file = new File("/tmp/frc_versions/FRC_Lib_Version.ini");
|
||||
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
file.createNewFile();
|
||||
|
||||
try (OutputStream output = Files.newOutputStream(file.toPath())) {
|
||||
output.write("Java ".getBytes(StandardCharsets.UTF_8));
|
||||
output.write(WPILibVersion.Version.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
DriverStation.reportError("Could not write FRC_Lib_Version.ini: " + ex.toString(),
|
||||
ex.getStackTrace());
|
||||
}
|
||||
|
||||
file.createNewFile();
|
||||
|
||||
try (OutputStream output = Files.newOutputStream(file.toPath())) {
|
||||
output.write("Java ".getBytes(StandardCharsets.UTF_8));
|
||||
output.write(WPILibVersion.Version.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
} catch (IOException ex) {
|
||||
DriverStation.reportError("Could not write FRC_Lib_Version.ini: " + ex.toString(),
|
||||
ex.getStackTrace());
|
||||
}
|
||||
|
||||
boolean errorOnExit = false;
|
||||
|
||||
Reference in New Issue
Block a user