06-19-2019 02:55 PM
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
Solved! Go to Solution.
06-20-2019 04:27 PM
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 Debug, Release, 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:
06-21-2019 03:44 PM
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!