Additional Information
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.vi
As 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.