LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Path Problem between application and subVIs

Solved!
Go to solution

I have a small problem. So I have this labview application that needs the path at different locations. So for application I use the application directory at all those places and the program works fine. But when there is some problem somewhere else in the application, then to debug it, I need to use LabVIEW itself, so here I use current VIs path. Now here comes the problem. All the subVIs are neatly placed in different subfolders, so I have to work on it each time, like get the current VIs path, go one folder up and stuff like that. So because of this I cannot initialize it at one place and use it everywhere. So everytime I have to debug, I need to change the location at all places from application path to current VIs path, which is a headache. Is there a easier way to do this or is there a way that a labview application can recognise itself that it is an application and not a VI, so then I can use a case structure and tell the program if it is application use application path, if not use current VIs path. Thank you. 

0 Kudos
Message 1 of 3
(530 Views)
Solution
Accepted by topic author govindsankar

Hi govindsankar,

 


@govindsankar wrote:

Is there a easier way to do this or is there a way that a labview application can recognise itself that it is an application and not a VI, so then I can use a case structure and tell the program if it is application use application path, if not use current VIs path.


The solution is to use the AppDir file constant ALL THE TIME!

 

From the help of this constant:

Returns the path to the directory containing the application.

If you call this VI from a stand-alone application, this VI returns the path to the folder containing the stand-alone application.

If you call this VI from the development environment and the VI is loaded in a LabVIEW project file (.lvproj), this VI returns the path to the folder containing the project file. If the project is not saved, this VI returns <Not a Path>.

You surely use a LabVIEW project when you edit/debug in the development environment, don't you?

Best regards,
GerdW


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