LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File paths after change computer

Solved!
Go to solution

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.

0 Kudos
Message 1 of 7
(3,930 Views)

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

0 Kudos
Message 2 of 7
(3,907 Views)

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".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(3,874 Views)

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 .

 

0 Kudos
Message 4 of 7
(3,866 Views)
Solution
Accepted by topic author MaxiBarac

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.

 

Example_VI

Message 5 of 7
(3,863 Views)

That is exactly what i was trying to accomplish !! Thanks a lot for your time & help it worked perfectly !! 

0 Kudos
Message 6 of 7
(3,857 Views)

Hi Maxi,

 

it seems to me you want to access files in the user Documents folder:

check.png("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… 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(3,847 Views)