1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-06-01 20:34:07 +02:00

Add full installer error/abort handling to the update installer

- Will abort and cleanup if full installer fails
- Fixed uninstallation files getting deleted if the full installer could
not be started
This commit is contained in:
chylex 2016-10-20 18:48:35 +02:00
parent 3e70d991bb
commit 334793c6f6

View File

@ -141,10 +141,10 @@ procedure CurStepChanged(CurStep: TSetupStep);
begin begin
if CurStep = ssInstall then if CurStep = ssInstall then
begin begin
TDExecuteFullDownload();
DeleteFile(ExpandConstant('{app}\unins000.dat')); DeleteFile(ExpandConstant('{app}\unins000.dat'));
DeleteFile(ExpandConstant('{app}\unins000.exe')); DeleteFile(ExpandConstant('{app}\unins000.exe'));
TDExecuteFullDownload();
end; end;
end; end;
@ -228,10 +228,18 @@ begin
WizardForm.ProgressGauge.Style := npbstMarquee; WizardForm.ProgressGauge.Style := npbstMarquee;
try try
if not Exec(InstallFile, '/SP- /SILENT /MERGETASKS="!desktopicon" /UPDATEPATH="'+UpdatePath+'"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin if Exec(InstallFile, '/SP- /SILENT /MERGETASKS="!desktopicon" /UPDATEPATH="'+UpdatePath+'"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
if ResultCode <> 0 then
begin
DeleteFile(InstallFile);
Abort();
Exit;
end;
end else
begin
MsgBox('Could not run the full installer, please visit {#MyAppURL} and download the latest version manually. Error: '+SysErrorMessage(ResultCode), mbCriticalError, MB_OK); MsgBox('Could not run the full installer, please visit {#MyAppURL} and download the latest version manually. Error: '+SysErrorMessage(ResultCode), mbCriticalError, MB_OK);
DeleteFile(InstallFile);
DeleteFile(InstallFile);
Abort(); Abort();
Exit; Exit;
end; end;