LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Non-Default Relative Paths in Build Specifications

Hello,

 

I would like to use relative paths to determine the build destination of my VIs and I was wondering if it was possible to use anything other than the default relative paths. I've done some searching on the forums and had a bit of luck, but I haven't gotten LabVIEW to use relative paths properly yet.

 

I'm storing my code on source code control, and I would like it so that if other developers check out my code, the builds get put in the same root folder.

 

So if someone checked out "TestProject" to anywhere and build the executables, they would end up with a folder structure like this:

directory.PNG

 

When I first make the build specification, the .lvproj does store it as a relative path, but I change anything it switches to absolute.

 

Original:

				<Property Name="Bld_localDestDir" Type="Path">../builds/NI_AB_PROJECTNAME/Test Build</Property>
				<Property Name="Bld_localDestDirType" Type="Str">relativeToCommon</Property>
				<Property Name="Bld_modifyLibraryFile" Type="Bool">true</Property>
				<Property Name="Bld_previewCacheID" Type="Str">{9E736E5C-AB97-4260-8A3F-56853A16C7EF}</Property>
				<Property Name="Bld_version.major" Type="Int">1</Property>
				<Property Name="Destination[0].destName" Type="Str">testprogram.exe</Property>
				<Property Name="Destination[0].path" Type="Path">../builds/NI_AB_PROJECTNAME/Test Build/testprogram.exe</Property>
				<Property Name="Destination[0].preserveHierarchy" Type="Bool">true</Property>
				<Property Name="Destination[0].type" Type="Str">App</Property>
				<Property Name="Destination[1].destName" Type="Str">Support Directory</Property>
				<Property Name="Destination[1].path" Type="Path">../builds/NI_AB_PROJECTNAME/Test Build/data</Property>
				<Property Name="DestinationCount" Type="Int">2</Property>

 dest1.PNG

 

Looks good so far. However, I want the executables to go in to ..\builds\, not ..\LabVIEW Code\builds\test project\Test Build.

 

So I changed the paths to this:

 

				<Property Name="Bld_localDestDir" Type="Path">../../builds</Property>
				<Property Name="Bld_localDestDirType" Type="Str">relativeToCommon</Property>
				<Property Name="Bld_modifyLibraryFile" Type="Bool">true</Property>
 				<Property Name="Bld_previewCacheID" Type="Str">{9E736E5C-AB97-4260-8A3F-56853A16C7EF}</Property>
				<Property Name="Bld_version.major" Type="Int">1</Property>
				<Property Name="Destination[0].destName" Type="Str">testprogram.exe</Property>
 				<Property Name="Destination[0].path" Type="Path">../../builds/testprogram.exe</Property>
				<Property Name="Destination[0].preserveHierarchy" Type="Bool">true</Property>
				<Property Name="Destination[0].type" Type="Str">App</Property>
				<Property Name="Destination[1].destName" Type="Str">Support Directory</Property>
				<Property Name="Destination[1].path" Type="Path">../../builds/data</Property>

 

 And when I re-open the project, it works!

 

But when I save the project and open the .lvproj file, the paths are now absolute:

				<Property Name="Bld_localDestDir" Type="Path">/C/LabVIEW/TestProject/builds</Property>
				<Property Name="Bld_modifyLibraryFile" Type="Bool">true</Property>
				<Property Name="Bld_previewCacheID" Type="Str">{9E736E5C-AB97-4260-8A3F-56853A16C7EF}</Property>
				<Property Name="Bld_version.major" Type="Int">1</Property>
				<Property Name="Destination[0].destName" Type="Str">testprogram.exe</Property>
				<Property Name="Destination[0].path" Type="Path">/C/LabVIEW/TestProject/builds/testprogram.exe</Property>
				<Property Name="Destination[0].path.type" Type="Str">&lt;none&gt;</Property>
				<Property Name="Destination[0].preserveHierarchy" Type="Bool">true</Property>
				<Property Name="Destination[0].type" Type="Str">App</Property>
				<Property Name="Destination[1].destName" Type="Str">Support Directory</Property>
				<Property Name="Destination[1].path" Type="Path">/C/LabVIEW/TestProject/builds/data</Property>
				<Property Name="Destination[1].path.type" Type="Str">&lt;none&gt;</Property>

 

And this is where I'm stuck. LabVIEW can read the relative path I give it fine, but it overwrites it with absolute paths when I save the project.


Is there any way to preserve the custom relative path?

 

Thank you for your time,

Nick

0 Kudos
Message 1 of 7
(3,871 Views)

Hi,

 

Thank you for the question. Just to clarify, how are you changing the file path when configuring the relative paths?

 

Are you editing the xml of the project file or setting it in the build specifications? Under what condition is it autosaving as an absolute path?

 

National Instruments
0 Kudos
Message 2 of 7
(3,829 Views)

Same doubt here.

Now I am using LV 2018 and it seems nothing has changed in this direction.

Have you overcome this issue?
Regards.

Felipe Pinheiro Silva


Follow my blog for LV content!

0 Kudos
Message 3 of 7
(3,269 Views)

Hi,

 

We still require absolute file paths for your LabVIEW build specifications. What exactly is your use case for using relative paths in the build specifications? We might be able to find a good workaround if we have a better idea of your exact use case. 

 

National Instruments

0 Kudos
Message 4 of 7
(3,251 Views)

Thanks for the reply.

Actually, I found an old thread in another forum about using the AppBuilder Library located in the vi.lib for building programmatically. In fact, it works even better than I thought and there I can set destination path (Primary Destination Path).

I can't recall the website where I read it from but the source code is below.

 

 

Felipe Pinheiro Silva


Follow my blog for LV content!

0 Kudos
Message 5 of 7
(3,239 Views)

In case this question is outstanding, if you're using source control, you most likely don't have the same working directory as your colleague. That means that you're constantly fiddling with build specs to make it point to the right location.

Tanner B.
Systems R&D Engineer - Aerospace, Defense, and Government
National Instruments
Message 6 of 7
(3,011 Views)

Same here. I'm currently using CI service by GitLab Runner. The runner clones the repos to a random folder, which makes it impossible to locate the correct position.

 

Very frustrating. I temporarily use post-action to copy built files to a relative path.

0 Kudos
Message 7 of 7
(2,875 Views)