From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Project File Pathname

Solved!
Go to solution

In the [Project Header] section of a .prj file there is "Pathname" component that is equal to the absolute path to the .prj file. What is this used for? I have noticed that if I copy the entire folder structure that contains my project and all of its included files to a different location, the old .prj file still works just fine for the purpose of building (even though the "pathname" attribute no longer is the path to the .prj file). When I build, it even uses the included files from the new (copied) folder structure (assuming they are included using relative paths).

 

What is "Pathname" used for?

When in section [File 0001] of the .prj file, "Path Is Rel = True" and "Path Rel To = "Project""  what location is used for the "Project" path, because it is not the "Pathname" in my case.

How can you choose when you are including a file what the path should be relative to?

 

For background, I am moving large projects into a Subversion repo. All the included files for a project are going to be in the repo, and we will checkout the entire file structure, so relative paths will work fine. But I am not sure what to do about this "Pathname" attribute of the .prj file.

 

Thanks

0 Kudos
Message 1 of 3
(2,757 Views)
Solution
Accepted by topic author ChrisWatson

Hi,

LabWindows/CVI attempts to resolve paths that were previously saved as absolute paths to be relative to the project. You can override this behavior by specifying the following options in the .prj file:

For a target file, specify the following in the [Create Executable] section of the .prj file:
Executable File_Configuration Force Path Absolute = True

where _Configuration is the configuration of your target, such as DebugRelease, or Debug64.

For a file in the project list, specify the following in the [File nnnn] section of the .prj file, where nnnn is the index of the file in the project list:
Path Force Path Absolute = True

 

Also, the default file path and file extension are saved as text field values in the  <your project name>.prj file. Editing these values will allow you to change the default path (also making it relative if you desire) as well as the default name for the built executables for your project. 

The following steps outline changing the default path and name to make it relative:

  1. Open the <your project name>.prj file in a text editor
  2. Scroll down to the [Create Executable] header
  3. Set the Executable File_Debug Is Rel value to True
  4. Add the Executable File_Debug Rel To value, and set it as desired
    • "Project" - where the project file is located
    • "CVI" - the base CVI path
    • "VXIPlug&Play" - the base VXIpnp path
  5. Add the Executable File_Debug Rel Path value, and set it as desired
    • if tracing "up" in your file structure, the string must begin with "../" not "/../"
    • the end of you string should be "<your desired executable name>.exe"
  6. Save your .prj file

 

Message 2 of 3
(2,718 Views)

Thank you! I also have a follow-up question:

 

For a file that is included using a relative address, does the Path attribute matter at all?

I am considering modifying the .prj to use relative paths instead of absolute paths. If in the process of doing this, I delete the "Path = ...." lines will everything work OK?

 

For example, I would end up trying to use this:

[File 0007]
File Type = "CSource"
Res Id = 7
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../Some/Path/To.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
Folder = "Source Files"
Folder Id = 0

 

Instead of what it is currently:

[File 0007]
File Type = "CSource"
Res Id = 7
Path Is Rel = False
Path Line0001 = "/c/Some/....Long/Path"
Path Line0002 = "That/Leads/To.c"
Exclude = False
Compile Into Object File = False

 

Can LabWindows deal with my new (mangled) .prj file? Will it at some point fill in the "Path = " line based of info it finds from following the relative path? So far it seems to work, but I do not want to cause problems for my team down the road when by using .prj files that do not conform to the expected syntax that LabWindows would have generated itself.

 

Thank you very much!

 

0 Kudos
Message 3 of 3
(2,701 Views)