From 06333f36bfee95edf39f6bedf3aa35d8ad8fb562 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 23 Feb 2010 23:32:49 +0000 Subject: [PATCH] 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. --- source/updatecheck.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/updatecheck.pas b/source/updatecheck.pas index 9ed9c1a3..bd7f9d9a 100644 --- a/source/updatecheck.pas +++ b/source/updatecheck.pas @@ -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