LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting .vi directory list from LabVIEW executable internally

I am trying to debug a LabVIEW project where I get an error where it cannot find a .vi in the compiled .exe. I have checked all the settings in the executable's build properties and the files are correctly listed as Always Included with the destination set to the .exe file. So I am trying to verify whether or not that this is true after the .exe is compiled. I know in current versions of LabVIEW it is not possible to look into a .exe you received from a third party but since I have the project files I was wondering if I could put a hook inside the project so that the .exe will publish its directory listing at run time. I am trying to use the "This VI" VI Server Reference in the project to access the directory list but I cannot find a property or subvi that will give me that information. My understanding is that with older versions of LabVIEW that you could use List Folder since the .exe was more similar in structure to a .dll than it is with more current versions. Is there an equivalent property or subvi that I can use with the "This VI" reference?

 

I am using LabVIEW 2013 SP1

 

Thanks

0 Kudos
Message 1 of 14
(5,340 Views)

I had an issue like this before and it turned out that I had a VI included in the project (located on the desktop but the project was saved on a network drive) that was screwing with the directory structure of the EXE.  When I moved the file into the same directory as the project files, everything worked as expected.  It had to do with preserving the directory structure and providing a common path for all of the file locations. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 14
(5,317 Views)

How are you calling this vi? I always include the vi and change properties to include in the \data directory. The build will then put all required files in the data directory.  To find the vi path you can use example. Vi Path.png

Message 3 of 14
(5,310 Views)

Yes, use Dave's example in the VI you are trying to locate and mark the VI as "show Front Panel" when loaded.

 

Run the exe and look for the path.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 14
(5,303 Views)

Better way to find vi path directory and if an exe. Vi Path.png

0 Kudos
Message 5 of 14
(5,299 Views)

Want yet another way?

 

Example_VI_BD.png

 

That being said the original question was asking about getting directory listings of the file structure in the EXE.  That feature was removed in version 8.2 for security reasons, and the structure of the EXE had changed.  For some time after that I you could treat an EXE as a zip, and extract the archive but that stopped working in 2010.  I looked into it a bit after that, extracting the EXE resources, then trying to extract the archives in that but didn't succeed.  You can extract an EXE and find the RCData, but after that I got stuck.  The VIs are in an archive of some kind in that data.

0 Kudos
Message 6 of 14
(5,283 Views)

@Dave_Brandt wrote:

Better way to find vi path directory and if an exe. 


Instead of the case structure, you could just use an Equals (would be easier to read).  But if you want to take it a step further, use a Conditional Diagram Disable structure, which would eliminate some of the logic in the final build (part RunTime property would not even be in the built executable).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 14
(5,279 Views)

I do not know the function to list exe structure like folder if that what you are asking for...

By default exe duplicates full folder structure to hold relative locations of VIs. So you can reference sub vi inside exe (only from another vi in the same exe) by the same relative path as in project. Use relative paths, not absolute for VIs, then you will not need to check whether it is exe or not.

In LV 2011 there is a build specification setting to set folder structure to single directory (C:\...\YourApp.exe\*.vi. Then relative path changes to trivial. Check/uncheck Advanced -> Use LabVIEW 8.x file layout

0 Kudos
Message 8 of 14
(5,258 Views)

@Alexander_Sobolev wrote:

By default exe duplicates full folder structure to hold relative locations of VIs. So you can reference sub vi inside exe (only from another vi in the same exe) by the same relative path as in project. Use relative paths, not absolute for VIs, then you will not need to check whether it is exe or not.

In LV 2011 there is a build specification setting to set folder structure to single directory (C:\...\YourApp.exe\*.vi. Then relative path changes to trivial. Check/uncheck Advanced -> Use LabVIEW 8.x file layout


Sounds like there's a lot of places for a drop in function for splash screens to break.  Or other code to work on a code structure of unknown complexity.  Did the developer check or uncheck the 8.x layout?  Did the developer make a folder structure in the EXE different than it was on disk?  Did LabVIEW decide to place a file in the EXE in a place in consistent with the source structure (LabVIEW has down weirder things with undocumented features), and whos to say the source structure is available as a reference?  What if I install this software on a computer with just the run-time engine then what?  

 

The best solution so far is to run a pre/post build VI that writes a file that goes with the EXE, which can be used as a reference so the structure is known when in an EXE.  But as I mentioned even this is error prone.  The best solution would be to restore the list folders functionality that was available at one point.  I can't seem to find it right now but I thought there was an idea exchange for this.

0 Kudos
Message 9 of 14
(5,254 Views)

I can open reference to VIs always included into exe by their path inside exe. Relative path from main vi is the same as in project - everything debugged, tested in development environment, no changes in exe. Run-time is enough, full LabVIEW not required. This works, no issues since LV 2009.

You do not have direct control over this structure inside exe: you set destination "into exe". Then it depeds only on 8.x layout checkmark.

External libraries for standalone tools are also an option, but not always the best.

0 Kudos
Message 10 of 14
(5,243 Views)