A Note about the Current VI’s Path Constant in LabVIEW
The current VI’s path constant in LabVIEW is often used to make the path of files which are in the same or relative folder of the VI application in our developments. If we use this constant in the development environment, everything is fine, and it works. But, if we build the VI into an executable, it will not find out the associated files because the path made is not correct.
Why this happens?
Because the path of a VI changes when we build it into an executable.
For example. If the VI is called myapp.vi, and it exists in the C:\MyApp directory. And assume that we have built an executable named myapp.exe, which also exists in the C:\MyApp directory. This is what the Current VI’s Path function will return:
In the LabVIEW development environment: C:\MyApp\myapp.vi
Running the executable (myapp.exe):C:\MyApp\myapp.exe\myapp.vi
So, when we have an executable, we actually need to strip the path twice to get to the correct directory.
No related posts.
2 Responses to “A Note about the Current VI’s Path Constant in LabVIEW”
Comment from Ralph
Time July 16, 2009 at 11:05 am
@BLW,
1) That file maybe in binary format, which can not be opened or viewed by text editor;
2) You can use LabVIEW’s Help>>Find Example menu to open the “NI Example Finder”, input your keyword there and you can find some examples to help you out.
Comment from BLW
Time July 4, 2009 at 10:41 pm
Hi there,
I am new to labview and have taken over a project at my new place of employment. I have two main problems at this point.
1) The person before me was using a path constant to read a waveform file to operate a set of mass flow controllers. The path constant leads back to a file that cannot be opened and manipulated. Do you know how I can find the original file?
2) I don’t know how to build a waveform sub vi (like in the above question) to operate a set of mass flow controllers. This waveform will need to be square and operate in the voltage range of 0 to 100 percent. Any examples out there that you know of? Can you point me in the right direction?
Thank you