LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Files directory for a Labview executable in Windows 7

I'd like to hear some opinions on this and ask what other people do. Most of my programs save data files that need to be accessible to the user, and some of them read text files that have been created by the user, e.g. a file containing a sequence of moves for a robot.

Where's a good place to put those files? In XP you could just stick them in a sub-directory in the application's directory in Program Files. Deprecated I'm sure, but simple. I think Windows 7 gets stroppy if you try to access files in an application's directory, and Windows 8, who knows? I'm pleased to say I've managed to avoid it so far.

 

Is there a "proper" place to put files that should be accessible to both the application and users? It must be accessible to all users, not just the one who's logged on. I've searched online and found remarkably little information about this.

 

For the sake of simplicity I'm tempted to just create a directory on the C: drive like C:\My Company\Program Name\. is there anything wrong with that?

 

0 Kudos
Message 1 of 6
(4,586 Views)

You could create a directory like that, just be sure all users have access rights to that directory.

 

There is a VI in LabVIEW that gives you paths to particular directories called "Get System Directory".  Look under File I/O >> File Constants palette.

 

For user based files, send it to the "User Documents" directory.

For files common to all users, send it to the "Public Documents" directory.

 

You'll probably want to create subFolders under each of those.

 

 

Message 2 of 6
(4,581 Views)

Yeah it is a bit more complicated now, but Microsoft tells us it is for the best.

 

It is pretty common to have a Application.INI in the same directory as your Application.EXE and in the past I'd use that file to hold basic config for my application.  You can still do this with LabVIEW but you need to add an extra step in the installer creation which tells Windows that the INI file should be able to be read and written by all users.   Just check the Unblock for that file when making an installer.

 

http://zone.ni.com/reference/en-XX/help/371361K-01/lvdialog/file_set_install_page/

 

It's non-standard technically, but it is handy to copy the EXE and config together and move them around and have everything still work, instead of now needing to copy config files to various user app data folders.

Message 3 of 6
(4,547 Views)

For programs that everyone needs to run, I keep them in the Public (All Users) directory under LabVIEW Programs.  For data files, I use an agreed-upon Data Drive (we tend to use E: for data collection).

Message 4 of 6
(4,540 Views)

"It is pretty common to have a Application.INI in the same directory as your Application.EXE and in the past I'd use that file to hold basic config for my application."

 

Yes, I use a config file for all my programs. In fact I've written a collection of VIs for reading and writing array variables and multiple keys. I use the config file to remember the paths to the directories for data and other files, which is another reason why I need to standardise the location of the program's working directory, so it's the same path whether I am writing the program or installing it as an executable.

 

0 Kudos
Message 5 of 6
(4,508 Views)

@CDancer wrote:

 

Yes, I use a config file for all my programs. In fact I've written a collection of VIs for reading and writing array variables and multiple keys.  


OpenG has a write Variant, read Variant, Write Cluster, and Read Cluster to/from INI.  It is very robust and has lots of useful features.  MGI also has some read/write anything VIs that are much faster than standard NI INI functions.

0 Kudos
Message 6 of 6
(4,491 Views)