10-06-2023 04:22 AM
I packaged an Application.exe on my D drive, which contains a folder 'Structrue',
and the output path when I run the program is: D:\builds\test\My Application\Application.exe\Structure.
Is there any way to list all the vi's contained in 'Structrue' folder?
10-06-2023 05:06 AM
10-06-2023 05:21 AM
I'm not even sure the exe explicitly stores a folder structure.
IIRC, VIs (.lvclass .ctl, etc.) do store their relative paths though.
So, you can try to get all VIs, classes, etc. by reference and use their path property to build a folder structure.
10-06-2023 07:22 PM
The listfolder doesn't work after packaging, it should only list items in the actual path.
I don't want to give away the contents of the structures, so I didn't pack the folder directly into the application directory. But I want to be able to dynamically get all the structures inside the folder so that I can parse the data inside the PLC.
10-06-2023 07:23 PM
I'll give it a try.
10-07-2023 12:32 PM
If I understand your question, I do this all the time, both when developing and when running the Executable. As you've noticed, by default, a standard Build creates a folder called "Data" at a known location in the path where you specify the Build. You can use LabVIEW functions to find this folder -- do a Build Path with "Application Directory" (defined in File I/O, File Constants) as the Folder and "Data" as the File). I also put a Data folder in my Project as a top-level folder in the Project, so when I'm testing my code during development, it will (also) find the Project's Data File in exactly the same location!
Files (and Folders) that you put in either the "Project" Data Folder (during Development) or "Execution" Data Folder (on your 😧 drive at the location you show in your Post) can be opened, listed, read, written, etc. as your application requires.
So going back to the "Question you asked" (as opposed to the "Question I chose to Answer", sorry about that), you should find your "Structure" folder by doing a Build Path with <Path from Application Directory File Constants> and "Structure", then doing whatever file I/O ("List Folder", for example) on the resulting Path. You can also, of course, read, write, delete, etc. files and folders you find there.
Something else of note. Suppose you want another Folder to show up on your Build, in addition to Data. In the Build, you can request additional Folders. Go to "Destinations" (third Category in Build) . You may already find the Data directory created under the "Destination" called Support Directory. I use this one as a "Write Mostly from the Program" folder. I often add a "Config" Folder (which has things to read) by clicking the Plus sign at the bottom, calling it something meaningful (like "Config"), and creating a meaningrful Path (I make it the same as for "Data", but substitute "Config" for "Data"). If you want to test your "Config" code during Development, simply add a Config Folder at the top level of the Project File structure.
Bob Schor
10-08-2023 01:51 AM - edited 10-08-2023 01:52 AM
wiebe@CARYA wrote:
I'm not even sure the exe explicitly stores a folder structure.
Actually an exe is more or less a ZIP file with all the compiled VIs.inside in the file structure as defined in the project/build settings, plus some startup executable that locates the LabVIEW runtime and loads and initializes it. In old times it used to be an LLB but that did not support classes and libraries well with their members that often are using the same file name.
Back then List Folder could browse.into an executable but the outcry was enormous about how this allowed anybody to steal the code in an executable (the thing one could “steal” were the names of the VIs and nothing more but paranoia can be an interesting state of mind). But NI listened and removed the ability to browse into exe files and did not add it back when they switched to the ZIP archive format. For a brief moment some unzippers could recognize the ZIP archive structure inside an exe but the internal format was changed enough that unzippers can’t unpack it anymore.
10-09-2023 02:33 AM
@rolfk wrote:
wiebe@CARYA wrote:
I'm not even sure the exe explicitly stores a folder structure.
Actually an exe is more or less a ZIP file with all the compiled VIs.inside in the file structure as defined in the project/build settings, plus some startup executable that locates the LabVIEW runtime and loads and initializes it. In old times it used to be an LLB but that did not support classes and libraries well with their members that often are using the same file name.
Back then List Folder could browse.into an executable but the outcry was enormous about how this allowed anybody to steal the code in an executable (the thing one could “steal” were the names of the VIs and nothing more but paranoia can be an interesting state of mind). But NI listened and removed the ability to browse into exe files and did not add it back when they switched to the ZIP archive format. For a brief moment some unzippers could recognize the ZIP archive structure inside an exe but the internal format was changed enough that unzippers can’t unpack it anymore.
Getting all VIs from an exe is still very easy of course.
Main questing here is why OP wants to do this?
07-03-2024 10:36 AM
wiebe@CARYA wrote:
Getting all VIs from an exe is still very easy of course.
How can a listing of the VIs or even just of the folders be gotten?
07-03-2024 10:59 AM
wiebe@CARYA wrote:
So, you can try to get all VIs, classes, etc. by reference and use their path property to build a folder structure.
How to get references of unopened dynamically-called Always Included VIs?