|
|
< >Why Can't My Executable Load My Included File When I Use Relative Path Encoding?</P> rimary Software: LabVIEW Development Systems
Primary Software Version: 6.1
Primary Software Fixed Version: N/A
Secondary Software:
Problem: I have created an application in LabVIEW that either creates or reads from an external file. I am using relative path encoding by using the Current VI's Path function in the Functions Palette » File I/O subpalette. My program runs in the development environment and is able to successfully perform file I/O. However, when I build my application into an executable using Application Builder, I receive an error indicating that either the file cannot be found, or the path is invalid.
Solution: Notice that when you use the Current VI's Path function in the development environment, it will return to you the path in which the VI is located as well as the name of the VI. Often, the Strip Path function is then used to remove this portion of the path, and then the path is used elsewhere in the program. When the program is now built into an executable, the name of the executable now becomes part of the path, in addition to the VI's name. For example, if a VI named "Application.vi" is saved in C:\Program Files\Application, the Current VI's Path function would return C:\Program Files\Application\Application.vi when run in the development environment. Now, if the VI is built into an executable with a name of "App.exe" and saved in the same directory location, the Current VI's Path function will return C:\Program Files\Application\App.exe\Application.vi. In this case, you will need to use the Strip Path function twice to strip both "Application.vi" and "App.exe" from the path to retrieve the directory in which the executable is located.
|
|