Only replace updater tool in temp directory if it has become outdated. Avoids annoyance for users which have whitelisted this .exe in their antivirus or whatever software.

This commit is contained in:
Ansgar Becker
2010-02-23 23:32:49 +00:00
parent 83360ba269
commit 06333f36bf

View File

@ -252,7 +252,11 @@ begin
Stream.WriteBuffer(ResPointer[0], SizeOfResource(HInstance, ResInfoblockHandle));
Stream.Position := 0;
UpdaterFilename := GetTempDir + AppName+'_updater.exe';
Stream.SaveToFile(UpdaterFilename);
if FileExists(UpdaterFilename) and (Stream.Size = _GetFileSize(UpdaterFilename)) then
// Do not replace old updater if it's still valid. Avoids annoyance for cases in which
// user has whitelisted this .exe in his antivirus or whatever software.
else
Stream.SaveToFile(UpdaterFilename);
// Calling the script will now post a WM_CLOSE this running exe...
ShellExec(UpdaterFilename, '', '"'+ParamStr(0)+'" "'+Download.Filename+'"');
finally