03-23-2015 04:23 AM
Hello all,
I wrote a Vi which is creating a file in the program folder where the vi is running in. During testing in Labview everything is working fine.
Now I created an installer to put the final vi as an exe to the c:\ProgramFile directory. When I open the program now the error massage appears that I do not have access to this folder ( I guess due to Windows limitations ).
Is there anything I can do to get access with my vi? Do I need to make a setting I haven't found or do I need to save everything somewhere else?
Many thanks in advance
03-23-2015 04:28 AM
Hi Danger,
I wrote a Vi which is creating a file in the program folder where the vi is running in.
That is the core of the problem. Don't create files in the program folder!
Microsoft recommends the user accessable folders like UserAppData and CommonAppData! Use them to have file access with each user account!
03-23-2015 05:16 AM
What GerdW has said is correct - you shouldn't really be writing to files inside Program Files in Windows > XP as it's no longer recommended practice by Microsoft.
What you can do, however, is tick the 'unlock' box on the folder your application is installed to in the installer build specification. This will make the folder user writeable so your application can write to files in it.
If you decide to use CommonAppData, you may need to 'unlock' a directory in there anyway (and I also had to put a file in it otherwise it didn't get unlocked properly).
03-23-2015 10:02 AM
@Dangermou5 wrote:
I wrote a Vi which is creating a file in the program folder where the vi is running in. During testing in Labview everything is working fine.
You don't say how you are obtaining the path, but you should also be aware that e.g. "current VIs path" will need an adjustment when used from inside an executable. See this article for example.
03-23-2015 10:19 AM
I totally agree with the others...but if you really want to stay with the old mind set of doing things in the Program Files folder you can. When making an NI installer you can choose to "Unlock" files, which basically means allow them to be read/write for all users, not just administrators which are the ones that normally have full rights to the Program Files folder.
http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/build_installer/
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-24-2015 08:03 AM
I often make executables, and LabVIEW's Application Builder usually puts them in <Project Folder>\builds\... -- this directory is typically somewhere in <My Documents>, perhaps in <LabVIEW Default Data Directory>. If I build this on a shared PC so that others can run it, I forget that "John" and "Mary" do not have access to my Documents folder when they log in to Windows. So I try to remember to specify a Destination Directory for the Build in <Users>\Public\Public Documents, and to put any Shortcuts that I create to the Executable on <Users>\Public\Public Desktop. This solves the "Accessibility" problem for us.
Bob Schor