Inno Setup: how to start the code procedure in the Run or Run section?

I want to delete the old database before installing the new one in order to update it for the user.

I have the following script:

In my section Components, I have an option for the user:

[Components]
Name: "updateDatabase";  Description: "Update Database";  Types: custom; \
    Flags: checkablealone disablenouninstallwarning

And I have a Codeprocedure in the section for execution, if the user selects this parameter in the execution section, before installing a new one.

[Code]
procedure RemoveOldDatabase();
begin
...
end;

[Run]
**--> Here I want to call RemoveOldDatabase if Components: updateDatabase is checked**
Filename: "database.exe"; StatusMsg: "Installing new database..."; Components: updateDatabase

Installing a new database is fine. The problem is that I want to remove the old one before installing the new one by calling the procedure RemoveOldDatabase.

Can I use only Inno Setup?

Thank.

+3
source share
1 answer

, , , , BeforeInstall [Run]. BeforeInstall ( , , ). :

[Run]
Filename: "database.exe"; Components: UpdateDatabase; BeforeInstall: RemoveOldDatabase

[Code]
procedure RemoveOldDatabase;
begin
  { ... }
end;
+5

Source: https://habr.com/ru/post/1651368/


All Articles