Log in

View Full Version : Default working directory for FRCUserProgram process?


lalondma
17-03-2015, 09:38
Hello,
Recently, I got a program crash because the text file that was supposed to be loaded by AutomonousInit (C++ - iterative robot) could not be found. The file was placed in /home/lvuser alongside the binary FRCUserProgram, so I expected a call like fopen("foo.txt","r") to work but it didn't. fopen("/home/lvuser/foo.txt","r") did work however, so it's not a permission issue. Also tried to put the file in "/home/admin" in case FRCUserProgram would run as admin, without success. Anybody knows what the default working directory is? "/", maybe?

connor.worley
17-03-2015, 12:59
http://linux.die.net/man/3/getcwd

Test and share results?

lalondma
18-03-2015, 17:53
Indeed, got it with getcwd (thanks for the tip):

/usr/local/natinst/labview

Not especially intuitive...

jhersh
19-03-2015, 23:46
Indeed, got it with getcwd (thanks for the tip):

/usr/local/natinst/labview

Not especially intuitive...

Sorry about that. I'll fix it for next season if you'll file a tracker at https://usfirst.collab.net/sf/tracker/do/listArtifacts/projects.wpilib/tracker.4_defects

kylelanman
20-03-2015, 00:10
We ran into a similar issue. Our findings indicated that the working directory was different when running while debugging and running when deployed. The quick fix for us was to use the entire path: /home/lvuser/Encoder_Offsets.txt.