It is required during installation to read the values from one ini-file and write them to another ini-file. The function for reading a string from an ini-file for some reason returns the default value passed to it, and not the value from the file. The file is where it should be, the values in it.
Here is an example script that reproduces the problem:
[Setup] AppName=MyApp AppVersion=1 DefaultDirName=D:\Projects\Test\ DisableDirPage=yes Uninstallable=no [INI] Filename: "{app}\INIFile2.ini"; Section: "Section"; Key: "Key1"; String: "{code:GetIniFileValue|'Key1'}" Filename: "{app}\INIFile2.ini"; Section: "Section"; Key: "Key2"; String: "{code:GetIniFileValue|'Key2'}" [Code] function GetIniFileValue(const Key: String): String; begin Result := GetIniString('Section', Key, 'DefaultValue', 'D:\Projects\Test\INIFile1.ini'); MsgBox(Result, mbInformation, MB_OK); // сообщение выводит результат функции GetIniString end; Contents of the INIFile1.ini file:
[Section] Key1=Value1 Key2=Value2 After the installation is completed, the INIFile2.ini file appears INIFile2.ini following contents:
[Section] Key1=DefaultValue Key2=DefaultValue How do I get the values from the first file?