LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

change of relative path after building application

HI!
I'm using the "current VI's Path" function to get the location of the VI and I build other pathes out of this original path. As soon as I create an exe it adds one path level. Example

before compilation:
path C:\example\test.vi
after compilation:
path C:\example\test.exe\test.vi

As I work with Strip and Build Path this leads to wrong or non existing directions. I had to add one Strip path more everywhere in order to get it working.
But then the .vi itself noncompiled is not working at the directories I want them to when testing without compilation.
What can I do?
ANDY
0 Kudos
Message 1 of 7
(4,360 Views)
One way to handle this is to create a boolean constant 'Built?' and use this to choose how many strip paths to execute. I have found this to generally result in a debug->build->curse->change_flag->rebuild cycle.

An automatic solution is attached. Basically you do two strip paths and select the proper path based on whether the second includes a .exe. Note that this will need to be modified if you build a .dll.

Matt
0 Kudos
Message 2 of 7
(4,360 Views)
Thanks very much. That works for me.
Just because I'm curious:
Is it a common "LabVIEW Problem" that this kind of situation occurs or did I miss something while prgramming? Shouldn't this be eliminated by NI or does it make sense in any way?
ANDY
0 Kudos
Message 3 of 7
(4,360 Views)
A common way of dealing with this is to check the run-time environment. You
can do this using a property node and check the App propery App.Kind. If
App.Kind = Run Time System, you need to add another Strip path.

You should also check out OpenG.com. The OpenG toolkit includes a function
"Current VIs Parent Directory" which continues to strip the calling vi's
path until it finds a valid directory.


"AndyBE" wrote in message
news:50650000000800000030F70000-1079395200000@exchange.ni.com...
> HI!
> I'm using the "current VI's Path" function to get the location of the
> VI and I build other pathes out of this original path. As soon as I
> create an exe it adds one path level. Example
>
> before compilation:
> path C:\example\test.vi
> after compilation:
> pa
th C:\example\test.exe\test.vi
>
> As I work with Strip and Build Path this leads to wrong or non
> existing directions. I had to add one Strip path more everywhere in
> order to get it working.
> But then the .vi itself noncompiled is not working at the directories
> I want them to when testing without compilation.
> What can I do?
> ANDY
0 Kudos
Message 4 of 7
(4,360 Views)
I think it is just a quirk to be learned. It does kind of make sense if you look at it (the 'VI path' .vi) as returning the 'source' of the .vi. In the IDE the 'source' is the directory structure. When you build an application you create a bundle of all the encompassed .vis, so their respective sources are based on the 'package'. At least that image worked for me; don't know whether it has any techincal validity.

Matt
0 Kudos
Message 5 of 7
(4,360 Views)
Hi Andy,

The previous answers describe the behaviour and the solution, but I want to show you this knowledgebase: http://digital.ni.com/public.nsf/websearch/FD7DE8BC8FFC256C862565F4006BE363?OpenDocument

It's a summary of this issue and you can download useful VI's. I recommend you to use the "VI server property approach".

Regards,
Luca
Regards,
Luca
0 Kudos
Message 6 of 7
(4,361 Views)
Writing this function yet again, hoped there was an easy way to get the parent directory directly (as a property?)
 
I followed Luca's link, but the VIs referred to there don't take LLBs into account (they'll strip parent EXE but not a parent LLB.)
 
The attached VI handles LLBs and outputs VI prefix, "Is EXE?", and immediate parent-path as well.
 

Message Edited by Dynamik on 11-15-2005 11:59 PM

Message Edited by Dynamik on 11-16-2005 12:01 AM

Message Edited by Dynamik on 11-16-2005 12:02 AM

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 7 of 7
(4,139 Views)