This content is not available in your preferred language.
The content is shown in another available language. Your browser may include features that can help translate the text.
I'm using the Current VI's Path constant and stripping off the VI name in order to access the owning directory. This works in the development environment, but when I build my VI into an executable I am having some problems, including, but not limited to receiving Error 7 occurred at New File. How do I build my VI to avoid changes when deploying it as an executable?
The issue can be addressed by the following:
Note: 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>. If the top-level VI is not loaded in a project, the VI returns the path to the directory containing the top level VI. If the VI is not saved to disk, this VI returns <Not a Path>.
Note: the leftmost VI is Open Application Reference, not Open VI Reference. Also, since this property searches for running LabVIEW executables, during development this property returns the path to your current instance of LabVIEW.
The Current VI's Path node returns the full path including the VI's name. This path varies based on whether the VI is running in the LabVIEW development environment or in a stand-alone application. LabVIEW wraps all VIs associated with a stand-alone application into an extra layer, which is actually the executable itself.Consider a VI named Application.vi located in the hard drive's root directory (e.g. C:\). In the LabVIEW development environment, the Current VI's Path function returns: C:\Application.vi Now consider the same VI built into a stand-alone application named MyApplication.exe. When running, the current VI's path function returns:
C:\MyApplication.exe\Application.viAs you can see from the different file paths above, you need to strip the path's differently depending on whether you are running in the development environment or on a stand-alone executable.
A more manual approach to the issue is to search the path for .exe. If it is not present in the path, you only need to strip the path once to get the owning directory. If it is present in the path, you must strip the path twice to return the owning directory.
Thank you for your feedback.
You changed your response to Not Helpful
You changed your response to Helpful
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.