I try to use same installer for both (fresh installation and update).
[Code]
will execute normally.[Code]
shouldn't be execute.So, how to implement exception function for this part of code (MySQL installation) if the installation is just updating?
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
{ ... }
begin
if CurStep = ssPostInstall then
begin
{ fresh installation code }
end;
end;
You can use IsUpgrade
function from my answer to
Can Inno Setup respond differently to a new install and an update?:
Though as it relies on a presence of "Uninstall" registry key, which already exists at the time of ssPostInstall
, you have to cache its value.
var
IsUpgradeCached: Boolean;
function InitializeSetup(): Boolean;
begin
IsUpgradeCached := IsUpgrade;
Result := True;
end;
procedure CurStepChanged(CurStep: TSetupStep);
{ ... }
begin
if (CurStep = ssPostInstall) and (not IsUpgradeCached) then
begin
{ fresh installation code }
end;
end;