mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Store preferences in a directory writable by lvuser
Change-Id: I1ed43968c2be76bfcb050a115f59517c398efff3
This commit is contained in:
@@ -18,7 +18,7 @@ static const char *kTableName = "Preferences";
|
||||
/** The value of the save field */
|
||||
static const char *kSaveField = "~S A V E~";
|
||||
/** The file to save to */
|
||||
static const char *kFileName = "wpilib-preferences.ini";
|
||||
static const char *kFileName = "/home/lvuser/wpilib-preferences.ini";
|
||||
/** The characters to put between a field and value */
|
||||
static const char *kValuePrefix = "=\"";
|
||||
/** The characters to put after the value */
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
|
||||
static const char *kFileName = "wpilib-preferences.ini";
|
||||
static const char *kFileName = "/home/lvuser/wpilib-preferences.ini";
|
||||
static const double kSaveTime = 0.2;
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Preferences {
|
||||
/**
|
||||
* The file to save to
|
||||
*/
|
||||
private static final String FILE_NAME = "wpilib-preferences.ini";
|
||||
private static final String FILE_NAME = "/home/lvuser/wpilib-preferences.ini";
|
||||
/**
|
||||
* The characters to put between a field and value
|
||||
*/
|
||||
|
||||
@@ -28,7 +28,7 @@ import edu.wpi.first.wpilibj.test.AbstractComsSetup;
|
||||
*/
|
||||
public class PrefrencesTest extends AbstractComsSetup {
|
||||
private static final Logger logger = Logger.getLogger(PrefrencesTest.class.getName());
|
||||
|
||||
|
||||
private NetworkTable prefTable;
|
||||
private Preferences pref;
|
||||
private long check;
|
||||
@@ -45,7 +45,7 @@ public class PrefrencesTest extends AbstractComsSetup {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
try {
|
||||
File file = new File("wpilib-preferences.ini");
|
||||
File file = new File("/home/lvuser/wpilib-preferences.ini");
|
||||
file.mkdirs();
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
@@ -109,7 +109,7 @@ public class PrefrencesTest extends AbstractComsSetup {
|
||||
assertEquals(pref.getFloat("checkedValueFloat", 0), 1, 0);
|
||||
assertTrue(pref.getBoolean("checkedValueBoolean", false));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testPreferencesToNetworkTables(){
|
||||
String networkedNumber = "networkCheckedValue";
|
||||
|
||||
Reference in New Issue
Block a user