I am trying to get the following Inno Setup code to work:
[Setup]
UserInfoPage=yes
[Code]
function CheckSerial(Serial: String): Boolean;
begin
Result := true;
SaveStringToFile('c:\Registration.txt', Serial, False);
end;
The code is extremely simple when the file path is known at UserInfoPage. However it becomes extraordinarily complex when I need to write this file next to my application. Neither:
WizardDirValue();
nor
ExpandConstant('{app}');
do work. The first one is empty when called too early and the second one does not even run, I get:
Internal error: an attempt was made to expand the "app" constant before it was initialized.
How does one store the Serial value to a file which needs to resides next to the application (.exe file) ?