10-27-2009 12:09 PM
Currently I reference a support directory in a top level VI by using the [Current VI's Path], [Strip Path] and appending "/data" to the returned file path. When I build the application my reference is no longer valid as [Current VI's Path] returns "Root/Directory/Application.exe/TopLevel.vi" instead of "Root/Directory/TopLevel.vi".
My question is how can I reference my Support Directory specified in the Application Builder within my code? If thats not possible how can I reference a file path that will stay valid in source and as a built application? I would not like to have to ensure default directories are the same across machines.
Thank You,
Mike
Solved! Go to Solution.
10-27-2009 03:06 PM
Hi Mike,
You can use a property node to determine if you are in development mode or runtime mode. Then strip out the exe name when in runtime.
Place a property node and select: application - kind
Set up a case structure to make your selections.
(In the snipit below I show two case structures just to show both names.)
steve
10-28-2009 04:22 AM
I would suggest doing something like this, because it will work in all combination (IDE, EXE, LLB, etc.).

You should note, however, that LV 2009 changed the way VIs go into an executable. If you're getting the path of the top level VI, you'll be fine. If you're starting from the middle of the hierarchy, however, you will get T from the Is Directory output while still inside the EXE, because the folder structure is maintained inside the EXE.
To work around this, LV 2009 also has a new VI in the file constants palette which returns the directory of the current application. This is what you should use if you're using 2009.
10-28-2009 08:24 AM
Thanks Steve and tst. I have tested both approaches and they both work for what I was intending to do. Sorry for duplicating a thread!
Mike