Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Relative Paths

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

A relative path describes the location of a file or directory relative to an arbitrary location in the file system. An absolute path describes the location of a file or directory starting from the top level of the file system. Relative paths are also referred to as symbolic paths. Use relative paths in VIs to avoid having to rework the paths if you build an application or run the VI on a different computer.

Complete the following steps to generate a path that functions regardless of differences in the location of the labview directory.

  1. Add the Default Directory function to the block diagram.

  2. Add the Build Path function to the block diagram.

  3. Wire the Default Directory constant to the base path input of the Build Path function.
  4. Right-click the name or relative path input of the Build Path function and select Create»Constant.
  5. Use the Labeling tool to double-click the name or relative path string constant and enter the following relative path using the syntax appropriate for your operating system:
    • (Windows) Enter user.lib\filename. An absolute path consists of the drive name, followed by a colon, followed by backslash-separated directory names, followed by the filename.
    • (Mac OS X) Enter user.lib:filename. An absolute path consists of the drive name, followed by colon-separated folder names, followed by the filename.
    • (Linux) Enter user.lib/filename. An absolute path consists of slash-separated directory names followed by the filename.


    The Build Path function returns the correct directory path for a file named filename in the labview\user.lib directory regardless of differences in the location of the labview directory if you run the VI on a different computer.

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit