templates: Exit-early if the user aborts the removal of an older version

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2023-05-20 16:46:46 +02:00 committed by Xaymar
parent 5bdcefd618
commit 07182d2f89

View file

@ -238,7 +238,10 @@ var
begin
// Attempt to remove old version if it exists.
if (IsUpgrade()) then begin
UninstallOldVersion();
if (UninstallOldVersion() != 0) then begin
Result := "Removal of older @PROJECT_NAME@ version was cancelled. Unable to continue with normal installation process, Setup will now abort."
exit;
end
end;
// Also ensure that we have the necessary prerequisites installed to run the program.
@ -404,7 +407,7 @@ begin
sUninstallerPath := GetUninstallerPath();
if (sUninstallerPath <> '') then begin
sUninstallerPath := RemoveQuotes(sUninstallerPath);
if Exec(sUninstallerPath, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES', '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
if Exec(sUninstallerPath, '', '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
Result := iResultCode
end else begin
Result := 1