2

I got the mission to save the actual installation path into an INI file (to a certain key). During installation, the user get a default folder to install the app, but he can change it in run-time (in the wizard). How to catch the final folder path he decided about, and place it into my INI file?

Thank you!

  • 3
    Note that most applications can discover the path to themselves while they're running using library/API calls, so there's no need to do this if it's for the use of the app itself. Writing the location to a file is only useful if it's required by some other app that can't figure it out any other way. – Miral Feb 07 '14 at 08:23
  • @Miral if you (happen to) install Javafx based applications (its native packaged installers on windows use inno setup), this could be useful (because finding the location of a jar file from within a running Java program is a bit hard) – Bjarne Boström Nov 24 '15 at 13:44
  • @BjarneBoström There are [several solutions to that](http://stackoverflow.com/questions/320542/how-to-get-the-path-of-a-running-jar-file)... – Miral Nov 27 '15 at 09:27

1 Answers1

1

You can save the value using an [Ini] entry and the {app} constant.

[INI]
Filename: "MyProg.ini"; Section: "InstallSettings"; Key: "InstallPath"; String: "{app}"

Note that as Gavin pointed out, an application can determine it's own path so this shouldn;t normally be needed unless external applications require it in which case, a registry entry is a lot easier to find:

[Registry]
Root: HKLM; Subkey: "Software\My Company\My Program\Settings"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"

([Ini] answer curtosy of TLama's deleted post.)

Community
  • 1
  • 1
Deanna
  • 23,876
  • 7
  • 71
  • 156