提交 4f5b23ef 编写于 作者: J Joao Moreno

update: should not show progress if user quits code

上级 802be774
...@@ -971,13 +971,18 @@ begin ...@@ -971,13 +971,18 @@ begin
Result := not IsBackgroundUpdate(); Result := not IsBackgroundUpdate();
end; 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; function ShouldRunAfterUpdate(): Boolean;
begin begin
if IsBackgroundUpdate() then if IsBackgroundUpdate() then
// VS Code will create a flag file before the update starts (/update=C:\foo\bar) Result := not LockFileExists()
// - 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}'))
else else
Result := True; Result := True;
end; end;
...@@ -998,6 +1003,14 @@ begin ...@@ -998,6 +1003,14 @@ begin
Result := ExpandConstant('{app}'); Result := ExpandConstant('{app}');
end; end;
function BoolToStr(Value: Boolean): String;
begin
if Value then
Result := 'true'
else
Result := 'false';
end;
procedure CurStepChanged(CurStep: TSetupStep); procedure CurStepChanged(CurStep: TSetupStep);
var var
UpdateResultCode: Integer; UpdateResultCode: Integer;
...@@ -1012,7 +1025,7 @@ begin ...@@ -1012,7 +1025,7 @@ begin
Sleep(1000); Sleep(1000);
end; 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;
end; end;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册