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:
Andrew Dassonville
2018-12-26 22:59:49 -08:00
committed by Peter Johnson
parent 8ac4b113a5
commit d817001259
2 changed files with 25 additions and 21 deletions

View File

@@ -98,13 +98,15 @@ RobotBase::RobotBase() : m_ds(DriverStation::GetInstance()) {
SmartDashboard::init();
std::FILE* file = nullptr;
file = std::fopen("/tmp/frc_versions/FRC_Lib_Version.ini", "w");
if (IsReal()) {
std::FILE* file = nullptr;
file = std::fopen("/tmp/frc_versions/FRC_Lib_Version.ini", "w");
if (file != nullptr) {
std::fputs("C++ ", file);
std::fputs(GetWPILibVersion(), file);
std::fclose(file);
if (file != nullptr) {
std::fputs("C++ ", file);
std::fputs(GetWPILibVersion(), file);
std::fclose(file);
}
}
// First and one-time initialization