diff --git a/build/win32/code.iss b/build/win32/code.iss index 1601f540fa2c3c82e8e3b0d4e9c3c4de989a03dc..4230f7d0517cff5a97f121fb15b6b4914479be14 100644 --- a/build/win32/code.iss +++ b/build/win32/code.iss @@ -971,13 +971,18 @@ begin Result := not IsBackgroundUpdate(); end; +// VS Code will create a flag file before the update starts (/update=C:\foo\bar) +// - if the file exists at this point, the user quit Code before the update finished, so don't start Code after update +// - otherwise, the user has accepted to apply the update and Code should start +function LockFileExists(): Boolean; +begin + Result := FileExists(ExpandConstant('{param:update}')) +end; + function ShouldRunAfterUpdate(): Boolean; begin if IsBackgroundUpdate() then - // VS Code will create a flag file before the update starts (/update=C:\foo\bar) - // - if the file exists at this point, the user quit Code before the update finished, so don't start Code after update - // - otherwise, the user has accepted to apply the update and Code should start - Result := not FileExists(ExpandConstant('{param:update}')) + Result := not LockFileExists() else Result := True; end; @@ -998,6 +1003,14 @@ begin Result := ExpandConstant('{app}'); end; +function BoolToStr(Value: Boolean): String; +begin + if Value then + Result := 'true' + else + Result := 'false'; +end; + procedure CurStepChanged(CurStep: TSetupStep); var UpdateResultCode: Integer; @@ -1012,7 +1025,7 @@ begin Sleep(1000); end; - Exec(ExpandConstant('{app}\inno_updater.exe'), ExpandConstant('--apply-update _ "{app}\unins000.dat"'), '', SW_SHOW, ewWaitUntilTerminated, UpdateResultCode); + Exec(ExpandConstant('{app}\inno_updater.exe'), ExpandConstant('_ "{app}\unins000.dat" ' + BoolToStr(LockFileExists())), '', SW_SHOW, ewWaitUntilTerminated, UpdateResultCode); end; end; diff --git a/build/win32/inno_updater.exe b/build/win32/inno_updater.exe index d82b1430c6407c1bf6a21418629564ddd599956e..6b8c7a981423d8c8c8cd66b1389b5864d2731d41 100644 Binary files a/build/win32/inno_updater.exe and b/build/win32/inno_updater.exe differ