How Do I Construct a Path to a Directory in LabVIEW?

Updated Sep 7, 2018

Reported In

Software

  • LabVIEW
  • LabVIEW Application Builder Module

Issue Details

I want to know which is the best practice to construct paths for directories in LabVIEW.  Ideally, I want to use this directories to store configuration files (INIs) and other stuff and have LabVIEW to read them and configure external hardware for me.  How do I construct a file path in LabVIEW?

Solution

The best practice would be to use the Application Directory VI:

This will ensure that the path will always be correct regardless if you are running this VI in LabVIEW Runtime engine (as an EXE) or in LabVIEW itself.

Additional Information

The Current VI's Path VI will change the VIs path depending if it is running on runtime engine (as an EXE file) or not.  This will lead to diferent paths in runtime or LabVIEW which could create an application that works with LabVIEW but not as an executable.

You can see this example in which the current VI's Path generates two different outputs depending on where it's running.