LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

relative file names

I want to have LV access a file of data but I want this done so that when
I use application builder and installer, it will know where to look for the
file. Currently I have an absolute reference to the file c:/test/data for
example. Is there a way to reference the file name relative to the folder
where the executable is located?
0 Kudos
Message 1 of 6
(3,309 Views)
quick and dirty solution
0 Kudos
Message 2 of 6
(3,309 Views)
Chris Anderson wrote:
>
> I want to have LV access a file of data but I want this done so that when
> I use application builder and installer, it will know where to look for the
> file. Currently I have an absolute reference to the file c:/test/data for
> example. Is there a way to reference the file name relative to the folder
> where the executable is located?

Two ways to do this.
1. Use "Current VI's path" and "Strip Path" to strip off two elements. This
will leave you with the folder that contains the EXE. Note this will return a
different path when used in the development environment.

2. In LV 5.x, use an Application Property node to return the
Application:Directory. In an EXE, it will return the folder that contains the
EXE. In the development environmen
t, it will return the folder that contains
the LabVIEW EXE.

In the Property node, there is also Application:Kind to determine if you are in
development or a built app.

Regards,
Brian Renken
http://Brian.Renken.com/LabVIEW
0 Kudos
Message 3 of 6
(3,309 Views)
Some snippage ensued:
> EXE. In the development environment, it will return the folder that
contains
> the LabVIEW EXE.
>
> In the Property node, there is also Application:Kind to determine if
you are in
> development or a built app.
>
> Regards,
> Brian Renken
> http://Brian.Renken.com/LabVIEW
>
Hey Brian,
I must be brain damaged as I cannot figure out how to do this with an
application:Kind thingy. Can you please describe in some detail how to
do this?

Thanks a lot!!!




Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 6 of 6
(3,309 Views)
In the File I/O Functions, underFile Constants there is a function
called "Current VI's Path" which should do as you want. It will
reference the path location to the called exe.

I have a problem in which I have created a command line utility that I
want to know what directory it was called from, not the directory of
the executable (which will be different in this case).

In article <38662436@newsgroups.ni.com>,
"Chris Anderson" wrote:
>
> I want to have LV access a file of data but I want this done so that
when
> I use application builder and installer, it will know where to look
for the
> file. Currently I have an absolute reference to the file
c:/test/data for
> example. Is there a way to reference the file name relative to the
fol
der
> where the executable is located?
>


Sent via Deja.com http://www.deja.com/
Before you buy.
0 Kudos
Message 4 of 6
(3,309 Views)
For similar purposes I have used the Win32 function GetCurrentDirectory (in
Kernel32) My subvi is attached. The return value is the current directory,
not the vi directory. Maybe this is what you're looking for?

regards,
Jaakko

wrote in message news:84r5ld$rr2$1@nnrp1.deja.com...
> In the File I/O Functions, underFile Constants there is a function
> called "Current VI's Path" which should do as you want. It will
> reference the path location to the called exe.
>
> I have a problem in which I have created a command line utility that I
> want to know what directory it was called from, not the directory of
> the executable (which will be different in this case).




[Attachment CurrentPath.vi, see below]
0 Kudos
Message 5 of 6
(3,309 Views)