From 339ef1ea3933b514fe2c9163ed9c3adf7b9b7c49 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Mon, 11 Sep 2023 18:47:31 -0400 Subject: [PATCH] [wpilib] DataLogManager: Warn user if logging to RoboRIO 1 internal storage (#5617) --- wpilibc/src/main/native/cpp/DataLogManager.cpp | 6 ++++++ .../main/java/edu/wpi/first/wpilibj/DataLogManager.java | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wpilibc/src/main/native/cpp/DataLogManager.cpp b/wpilibc/src/main/native/cpp/DataLogManager.cpp index 3352d4db8e7..0877b2225fb 100644 --- a/wpilibc/src/main/native/cpp/DataLogManager.cpp +++ b/wpilibc/src/main/native/cpp/DataLogManager.cpp @@ -21,6 +21,7 @@ #include "frc/DriverStation.h" #include "frc/Filesystem.h" +#include "frc/RobotBase.h" using namespace frc; @@ -69,6 +70,11 @@ static std::string MakeLogDir(std::string_view dir) { (s.permissions() & fs::perms::others_write) != fs::perms::none) { return std::string{usbDir}; } + if (frc::RobotBase::GetRuntimeType() == kRoboRIO) { + FRC_ReportError(warn::Warning, + "DataLogManager: Logging to RoboRIO 1 internal storage is " + "not recommended! Plug in a FAT32 formatted flash drive!"); + } #endif return frc::filesystem::GetOperatingDirectory(); } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java index 5a154683742..2f5a55f9720 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DataLogManager.java @@ -204,8 +204,13 @@ private static String makeLogDir(String dir) { } catch (IOException ex) { // ignored } + if (RobotBase.getRuntimeType() == RuntimeType.kRoboRIO) { + DriverStation.reportWarning( + "DataLogManager: Logging to RoboRIO 1 internal storage is not recommended!" + + " Plug in a FAT32 formatted flash drive!", + false); + } } - return Filesystem.getOperatingDirectory().getAbsolutePath(); }