How to set DefaultDirName in Inno setup from ini file?

I need to pull the DefaultDirName info from an ini file in the Windows directory, how do I do it?

+3
source share
2 answers


I use the following code in a section [code]to get a string from an INI file (in the example: [InstallSettings] section, variable name: DefDirName):

[code]
function GetDefDirName(Param: String): String;
begin
  Result := GetIniString('InstallSettings', 'DefDirName', '', 'c:\your_app_dir\file_with_info.ini'));
end;

and at the very top of the script section in [Setup]:

DefaultDirName={code:GetDefDirName}
+4
source

you can also do.

[Setup]
DefaultDirName={ini:Filename,Section,Key|DefaultValue}
+4
source

All Articles