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
section I have an option for the user:
[Components]
Name: "updateDatabase"; Description: "Update Database"; Types: custom; \
Flags: checkablealone disablenouninstallwarning
And I have in Code
section, a procedure to execute, if the user selects this option, in the run section, before installing the 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
The installation of the new database works fine. The problem is I want to remove the old one before installing the new one, calling the procedure RemoveOldDatabase
.
Is it possible by only using Inno Setup?
Thanks.
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. ABeforeInstall
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: