07-02-2010 06:53 AM
the system will have multiple users, test records are to be saved to the c:\Documents and Settings\<user>\Application Data\Pacing System\
how do I determine this path for various users dynamically?
Solved! Go to Solution.
07-02-2010 07:27 AM
Try this 😉
/Y
07-02-2010 07:50 AM
Use the Default Data Directory VI found in "Functions >> Programming >> File I/O >> File Constants"
Use Strip Path and Build Path accordingly...
07-02-2010 08:57 AM - edited 07-02-2010 09:02 AM
I like the "Get System Directory" vi found in the File Constants subpalette of the File I/O palette. It might be LV2009 only.
Note that the Application Data directory is hidden by default in win7. In win7 x64 this returns "C:\Users\<user>\AppData\Local\Pacing System\" In XP, it's "C:\Documents and Settings\<user>\Local Settings\Application Data\Pacing System\"
Yamaeda's registry approach gives me "C:\Users\<user>\AppData\Roaming" Querying the "LOCALAPPDATA" or the "USERPROFILE" keys are also close to what you want. If XP doesn't have these keys, you could also call a command line and query the %userprofile% environment variable.
@Phil: I've had trouble with the "Default Data Directory" vi before (yesterday in fact). It depends on an options setting within labview. (Options>Paths), I found that when I change this path in the options to use the system directory (uncheck "use default", click the exclamation point button, click on replace, then OK out of options), it gets reset to the default value when labview is restarted, even though it shows up in Labview.ini. This only happens if you use the system-specific path. It appears to be an old problem:http://forums.ni.com/t5/LabVIEW/Custom-default-data-directory-path-reverts-to-Labview-default/m-p/36...