Inno Setup: How to run a code procedure in Run section or before Run section?

后端 未结 1 1431
野趣味
野趣味 2021-01-06 11:45

I want to remove the old database before installing the new one, to update it for the user.

I have the following scenario:

In my Components sect

相关标签:
1条回答
  • 2021-01-06 12:36

    One way, in my view really simple and still descriptive, is to execute your procedure as a BeforeInstall parameter function of your [Run] section entry. A BeforeInstall parameter function is executed once right before an entry is processed (and only if it's processed, which in your case is when the component is selected). You would write just this:

    [Run]
    Filename: "database.exe"; Components: UpdateDatabase; BeforeInstall: RemoveOldDatabase
    
    [Code]
    procedure RemoveOldDatabase;
    begin
      { ... }
    end;
    
    0 讨论(0)
提交回复
热议问题