From 4a70b008c1d1c6408e01d48ff831df69e3067df4 Mon Sep 17 00:00:00 2001 From: dolphin6k Date: Tue, 11 Jan 2022 15:47:59 +0900 Subject: [PATCH] Do not show message box to confirm uninstallation of old install when /VERYSILENT switch specified. --- win32/tuxpaint.iss | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/win32/tuxpaint.iss b/win32/tuxpaint.iss index 687266b01..0466ab90e 100644 --- a/win32/tuxpaint.iss +++ b/win32/tuxpaint.iss @@ -255,6 +255,19 @@ begin Result := Path; end; +function CmdLineParamExists(const Value: string): Boolean; +var + I: Integer; +begin + Result := False; + for I := 1 to ParamCount do + if CompareText(ParamStr(I), Value) = 0 then + begin + Result := True; + Exit; + end; +end; + Procedure ForceUninstallPreviousX86Install(); var ResultCode: Integer; @@ -263,12 +276,18 @@ begin begin if FileExists('C:\Program Files (x86)\TuxPaint\unins000.exe') then begin - if MsgBox('Old version will be uninstalled automatically.', mbInformation, MB_OKCANCEL) = IDOK then + if CmdLineParamExists('/VERYSILENT') = False then begin - Exec('C:\Program Files (x86)\TuxPaint\unins000.exe', '/SILENT', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); + if MsgBox('Old version will be uninstalled automatically.', mbInformation, MB_OKCANCEL) = IDOK then + begin + Exec('C:\Program Files (x86)\TuxPaint\unins000.exe', '/SILENT', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); + end + else begin + Abort; + end; end else begin - Abort; + Exec('C:\Program Files (x86)\TuxPaint\unins000.exe', '/VERYSILENT', '', SW_SHOW, ewWaitUntilTerminated, ResultCode); end; end; end;