From 9bcad254ba31534b830eb51d207893d4d46f9d44 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Sun, 4 Jan 2009 21:40:21 +0100 Subject: [PATCH] WinGit: Delete duplicate files from the bin directory when using libexec layout When upgrading from a pre-libexec version to a libexec version, the installer now deletes all files that are present in both the bin and libexec directories from the bin directory. Intentionally, this e.g. keeps files which the user might have copied to the bin directory himself. --- share/WinGit/install.iss | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/share/WinGit/install.iss b/share/WinGit/install.iss index c4886b82..0fbeaee4 100644 --- a/share/WinGit/install.iss +++ b/share/WinGit/install.iss @@ -428,6 +428,7 @@ var BuiltIns,EnvPath,EnvHome,EnvSSH:TArrayOfString; Count,i:Longint; IsNTFS:Boolean; + FindRec:TFindRec; RootKey:Integer; begin if CurStep<>ssPostInstall then begin @@ -497,6 +498,19 @@ begin Log('Line {#emit __LINE__}: Successfully created built-in aliases as file copies.'); end; + + // Delete any duplicate files in case we are updating from a non-libexec to a libexec directory layout. + if FindFirst(AppDir+'\libexec\git-core\*',FindRec) then begin + repeat + if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY)=0 then begin + FileName:=AppDir+'\bin\'+FindRec.name; + if (FileExists(FileName) and (not DeleteFile(FileName))) then begin + Log('Line {#emit __LINE__}: Unable to delete dupe "'+FileName+'", ignoring.'); + end; + end; + until not FindNext(FindRec); + FindClose(FindRec); + end; end else begin Msg:='Line {#emit __LINE__}: Unable to read file "{#emit APP_BUILTINS}".'; MsgBox(Msg,mbError,MB_OK); -- 2.11.4.GIT