Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use PATH

Status
Not open for further replies.

jepadams

Technical User
Aug 19, 2002
7
US
I have built a "board" that plugs into the par port to control all the fans and pumps in my greenhouse.

The program works properly.

My Question is, for packaging and distrabution, how should I write the code to access my .ini file that holds the variables.

Right now I have it "hard coded" to MyDocuments\Controler\Controler.ini

But when using the packageing wizard it installs the .exe to "c:\Programs\controler

And I would like the .ini to go into the install directory.

How do I do that?

In advance, Thanks for the help.
 
If you want the current working directory you can use CurDir() and if you want the directory that the application is installed to, use the App.Path property. Curdir is useful if you have the shortcut starting in one folder while running the program from another, such as in a network installation where users have only read access to the application folder and write access to the data folder. However this probably isn't the case and you'll be keeping the .exe and .ini in the same folder, so the app.path will work perfectly.
 
Use App.Path & "\Controler.ini"

App.Path returns the name of the drive and folder that is currently running your applications in your case App.Path would be equal to c:\Programs\controler

Adding the & "\Controler.ini" to the end gives you the full path. This works no matter what folder your application is installed into as long as the ini file is in the same folder. For other folders just add path info as well.
eg; App.Path & "\INIfile\Controler.ini"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top