Help w/ WPILib Preferences

Hi -

I had something that worked for this last year, and things in WPILib have changed, and I’m having problems with the same approach this year.

The name of the file stored on the roboRIO in the lvuser home directory has changed (now networktables.ini), the header or 1st line is different, and the format of the properties themselves are different. I got through all that.

So that I don’t have to use the SmartDashboard to get the properties loaded, we had a script that used pscp (from Putty) to download a copy of the file on command from the development laptop to the roboRIO.

The problem is that WPILib now throws a complaint about the format of the header, and refuses to process the rest of the file. If I do a diff of the file as copied from my Windows development laptop and the one written by the pscp copy, every line is different, but there is no discernible difference … so I’m thinking maybe it is the way the end of line is handled on Windows vs. Linux?

WARNING: /home/lvuser/networktables.ini:1:header line mismatch, ignorning rest of file (Dispatcher.cpp:71)
WARNING: When reading initial persistent values from ‘/home/lvuser/networktables.ini’:(Dispatcher.cpp:69)[/INDENT]

It used to work without problems … And I can live with running the SmartDashboard every time they change just to update the file, but it’s kind of awkward and inconvenient. Does anyone from WPILib development know if there is some other problem I can fix on my end?

Thanks in advance!
Stu

It looks like it will fail if you use windows line endings. Based on quick research, pscp keeps the original line endings. I suspect pscp downloads with unix line endings, and your text editor changes them to windows line endings, and then pscp sends it back as windows line endings.

I’ve successfully done this with filezilla, which will change line endings from unix to windows when transferring to windows and back to unix when transferring to unix. Alternately you can use a text editor that doesn’t mess with the line endings.

I don’t have access to a RoboRIO right now, but if the “tr” command is available you can ssh to the RoboRIO and use it to strip the carriage returns from the file copied by pscp.

cat networktables.ini |tr -d “\r” >q
mv q networktables.ini