04-07-2018 05:49 PM
Hi friends, i have a problem with file paths, every time i make a .VI developed in my pc when i install it in other pc as it is espected if i'm using files, the paths are different, i always edited manually the paths with the final user pc names, but this time i use lots of paths and i want to avoid that job when installing the .VI in the final user.
As Example:
my path "C:\Users\Maxi\Documents\MEGAsync\soft.vi"
client path "C:\Users\Client1\Documents\MEGAsync\soft.vi"
when i'm developing the .vi i use my path but after installing the .vi in the client pc obviously it won't work as he has a different path.
Could you give me some ideas how to avoid having to modify all the paths with the client paths in advance?
Thank you all for your time and valious help.
Solved! Go to Solution.
04-07-2018 08:36 PM
There are several methods. The File I/O Palette has a set of File Constants that you can use as "roots" to build relative File Paths. You can also create/use a defined folder, for example "C:\My LabVIEW Data" -- you'd want to check to see if this Folder exists ("Check if File or Folder Exists" on File I/O, Advanced, Palette) and create it if it doesn't. You could also define a Share and specify the File Path as \\Share\<File Name>. I've used all three methods to good results.
Bob Schor
04-09-2018 07:00 AM
My most common method is using the Application Directory function. This primitive will give you a path to the folder of the project file (in the development environment) or the executable (in the runtime environment). Using that, you can use Build Path to create the full path of your file. This is referred to as using "relative paths".
04-09-2018 07:36 AM
Using that the user will have to select the path every time he runs the .VI ?? I want the .VI files to be stored in Mega folder (like google drive or dropbox) i mean the MEGAsync folder will exist always in every pc the .VI will run .
my path "C:\Users\Maxi\Documents\MEGAsync\soft.vi"
client path "C:\Users\Client1\Documents\MEGAsync\soft.vi"
Thanks for your time .
04-09-2018 07:52 AM - edited 04-09-2018 07:53 AM
No.
The Get System Directory will give you the first part of the file path, the part that is changing depending on who the user is. Then you programmatically build the rest of the path.
04-09-2018 08:03 AM
That is exactly what i was trying to accomplish !! Thanks a lot for your time & help it worked perfectly !!
04-09-2018 08:18 AM - edited 04-09-2018 08:19 AM
Hi Maxi,
it seems to me you want to access files in the user Documents folder:
("Benutzerdokumente": "user documents"…)
Never use absolute paths in your executables. Use known (and existing) folders/paths…
Edit: it seems it took me too long to write an answer… 😄