LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modifing INI Files based on installation directory

Hello
 
I have an app that I want to build and deploy as an installable program.  I use a lot of information from an INI file for various program operations.
This works great when I use LabView to open the app and run it.  But how do I handle the paths in the  INI file once a user has installed the application on their  PC in the directory of thier choice?
 
Any help would be appreciated
Tim C.
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 1 of 4
(2,528 Views)
Ok, the first point is NEVER put full paths in an *.ini file.

The best way to locate things is to have everything relative to the VI that is executing. I know that at first this sounds a bit counter-intuitive, but think about it for a minute. In a built application all the VIs are typically in the same place - the executable. Hence you can take the path of any VI in the library, strip it twice (once to remove the VI name, and once to remove the executable name) and get the path where the application is installed.

One exception of course is if you build the application with the strap set to produce a small executable and all the other VIs in a seperate library. In that situation all but the top-level VI are in the same place (the library). The second obvious exception, is the development environment where things can be anywhere. To handle any of the above situations, I have a subVI that checks to see whether it is running under a development system or the runtime engine - and then assembles the path accordingly.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 4
(2,525 Views)
Hello
 
Thanks for the Reply,  Which ofcourse leads to more questions:)
 
I have a directory stucture setup as follows
 
Main Directory - Were the TOP Level VI will be located at build time
Sub directory called Common VIs this is where shared VIs go AND is where my INI file is sitting
Sub directory APP1
Sub Directory APP2
 
My interpertation of your answer is that I need to move my INI file to the Main Directory,  Is this Correct?
 
 
Another Question - How do i use = in a key string?  Some of my key strings have an equal symbol at the end of the string
some days things work as intended and other days the app acts flakey.  But when I tweek the key and get rid of the = the app returns the expected results.
 
The Key string is used as a regular expression input to a String Match VI.
 
Any Help would be appreciated.
 
Thanks
Tim C.
1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
0 Kudos
Message 3 of 4
(2,498 Views)


@Tim C. wrote:
Hello
 
Thanks for the Reply,  Which ofcourse leads to more questions:)
 
I have a directory stucture setup as follows
 
Main Directory - Were the TOP Level VI will be located at build time
Sub directory called Common VIs this is where shared VIs go AND is where my INI file is sitting
Sub directory APP1
Sub Directory APP2
 
My interpertation of your answer is that I need to move my INI file to the Main Directory,  Is this Correct?
 
Actually, the point is that the ini file for your application will be there, whether you create it there or not, so you can use it to store your other setup information as well. All you have to do is create your own keys.
 
Another Question - How do i use = in a key string?  Some of my key strings have an equal symbol at the end of the string
some days things work as intended and other days the app acts flakey.  But when I tweek the key and get rid of the = the app returns the expected results.
 
There is a way of delimiting strings such that they can contain whatever you want - but which I don't remember right now. If you use the ini file IO routines that come with LV there's a function for writing string keys that will handle it for you.
 
The Key string is used as a regular expression input to a String Match VI.
 
Any Help would be appreciated.
 
Thanks
Tim C.




Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 4
(2,490 Views)