From 31dd6ff5dec1f10421aafa3ffab99699ca3e4d17 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Sun, 4 Nov 2012 12:18:27 +0100 Subject: [PATCH] Installer: Delete installed files from VirtualStore (issue #21) Delete files that are successfully installed from the according VirtualStore path so that new files do not get superseded by old ones. Signed-off-by: Sebastian Schuberth --- share/WinGit/install.iss | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/share/WinGit/install.iss b/share/WinGit/install.iss index 1e4f444c..fe2d5ceb 100644 --- a/share/WinGit/install.iss +++ b/share/WinGit/install.iss @@ -75,11 +75,11 @@ Name: consolefont; Description: {#COMP_CONSOLE_FONT}; Types: custom [Files] ; Install files that might be in use during setup under a different name. -Source: git-cheetah\git_shell_ext.dll; DestDir: {app}\git-cheetah; DestName: git_shell_ext.dll.new; Flags: replacesameversion; Components: ext\cheetah -Source: git-cheetah\git_shell_ext64.dll; DestDir: {app}\git-cheetah; DestName: git_shell_ext64.dll.new; Flags: replacesameversion; Components: ext\cheetah +Source: git-cheetah\git_shell_ext.dll; DestDir: {app}\git-cheetah; DestName: git_shell_ext.dll.new; Flags: replacesameversion; Components: ext\cheetah; AfterInstall: DeleteFromVirtualStore +Source: git-cheetah\git_shell_ext64.dll; DestDir: {app}\git-cheetah; DestName: git_shell_ext64.dll.new; Flags: replacesameversion; Components: ext\cheetah; AfterInstall: DeleteFromVirtualStore -Source: *; DestDir: {app}; Excludes: \*.bmp, gpl-2.0.rtf, \*.iss, \tmp.*, \bin\*install*, \git-cheetah\git_shell_ext.dll, \git-cheetah\git_shell_ext64.dll; Flags: recursesubdirs replacesameversion sortfilesbyextension -Source: ReleaseNotes.rtf; DestDir: {app}; Flags: isreadme replacesameversion +Source: *; DestDir: {app}; Excludes: \*.bmp, gpl-2.0.rtf, \*.iss, \tmp.*, \bin\*install*, \git-cheetah\git_shell_ext.dll, \git-cheetah\git_shell_ext64.dll; Flags: recursesubdirs replacesameversion sortfilesbyextension; AfterInstall: DeleteFromVirtualStore +Source: ReleaseNotes.rtf; DestDir: {app}; Flags: isreadme replacesameversion; AfterInstall: DeleteFromVirtualStore [Icons] Name: {group}\Git GUI; Filename: {app}\bin\wish.exe; Parameters: """{app}\libexec\git-core\git-gui"""; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\etc\git.ico @@ -169,6 +169,25 @@ Type: dirifempty; Name: {app}\home #include "putty.inc.iss" #include "modules.inc.iss" +procedure DeleteFromVirtualStore; +var + VirtualStore,FileName:String; + DriveChars:Integer; +begin + VirtualStore:=AddBackslash(ExpandConstant('{localappdata}'))+'VirtualStore'; + FileName:=ExpandConstant(CurrentFileName); + DriveChars:=Length(ExtractFileDrive(FileName)); + if DriveChars>0 then begin + Delete(FileName,1,DriveChars); + FileName:=VirtualStore+FileName; + if FileExists(FileName) and (not DeleteFile(FileName)) then begin + Log('Line {#__LINE__}: Unable delete "'+FileName+'".'); + // This is not a critical error, the user can probably fix it manually, + // so we continue. + end; + end; +end; + function CreateHardLink(lpFileName,lpExistingFileName:String;lpSecurityAttributes:Integer):Boolean; #ifdef UNICODE external 'CreateHardLinkW@Kernel32.dll stdcall delayload setuponly'; -- 2.11.4.GIT