ben432rew
ben432rew

Reputation: 1902

Pascal procedure not writing how I expect

I'm trying to create an installer using Inno Setup, which I have never used before, and everything is working fine, except that I'd like a VERSION.txt file to be created on installation. Here's what I've 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 there is no VERSION.txt file being created at all after I compile and run the installer. I've never used Pascal before, and this is as far as I could get before I gave up. Why is the file not being created?

EDIT:
I tried adding

begin
  nowWrite();          
end.

to the end as suggested by @TLama, but it is still not writing a new file.

Thanks in advance for the help!

Upvotes: 3

Views: 63

Answers (1)

Abstract type
Abstract type

Reputation: 1921

You have to call noWrite in an standard installer event. Currently your code is never called.

Supported events are listed on this page

for example:

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

will call your custom code when the setup's finished. Just study the documentation to choose the event which matches to your needs.

Upvotes: 1

Related Questions