Pascal's procedure does not write as I expect

I am trying to create an installer using Inno Setup, which I have never used before and everything works fine, except that I would like to create a VERSION.txt file on installation. This is what I got so far, at the very end of my script:

[Code]
procedure writeVersion();
begin
  SaveStringToFile(ExpandConstant('{app}\VERSION.txt'), '{#MyAppVersion}', False);
end;

procedure nowWrite();
begin
  writeVersion();
end;            

      

But the VERSION.txt file is not generated at all after compiling and running the installer. I had never used Pascal before, and this is as far as I could before I gave up. Why isn't the file being created?

EDIT:
I tried adding

begin
  nowWrite();          
end.

      

to the end as @TLama suggested, but it still doesn't write a new file.

Thanks in advance for your help!

+3


source to share


1 answer


You must call noWrite

on a standard installer event. Currently, your code is never called.

Supported events are listed on this page

eg:



procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
    nowWrite();  
end;

      

will call your custom code when the installation is complete. Just read the documentation to choose the event that suits your needs.

+1


source







All Articles