[gimp] Installer: clean up old .debug files during install (they're useless)



commit f557b22d2397fd005cb62d89734fb091c0bd7f9c
Author: Jernej Simončič <jernej|s-cccp eternallybored org>
Date:   Tue May 15 00:01:08 2018 +0200

    Installer: clean up old .debug files during install (they're useless)

 build/windows/installer/gimp3264.iss      |   54 ++++++++++++++++++++++++++++-
 build/windows/installer/lang/setup.isl.in |    2 +
 2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/build/windows/installer/gimp3264.iss b/build/windows/installer/gimp3264.iss
index a705776..515f461 100755
--- a/build/windows/installer/gimp3264.iss
+++ b/build/windows/installer/gimp3264.iss
@@ -201,7 +201,7 @@ Name: deps64; Description: "{cm:ComponentsDeps,{#GTK_VERSION}}"; Types: full com
 Name: deps64\wimp; Description: "{cm:ComponentsGtkWimp}"; Types: full custom; Flags: dontinheritcheck 
disablenouninstallwarning; Check: Check3264('64')
 
 #ifdef DEBUG_SYMBOLS
-Name: debug; Description: "{cm:ComponentsDebug}"; Types: custom
+Name: debug; Description: "{cm:ComponentsDebug}"; Types: custom; Flags: disablenouninstallwarning
 #endif
 
 Name: gs; Description: "{cm:ComponentsGhostscript}"; Types: full custom
@@ -1467,9 +1467,61 @@ begin
 end;
 
 
+procedure RemoveDebugFilesFromDir(pDir: String; var pDirectories: TArrayOfString);
+var FindRec: TFindRec;
+begin
+DebugMsg('RemoveDebugFilesFromDir', pDir);
+       if FindFirst(AddBackSlash(pDir) + '*', FindRec) then
+       begin
+               try
+                       repeat
+                               if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY = 0 then
+                               begin
+                                       if (Length(FindRec.Name) > 6) and (LowerCase(Copy(FindRec.Name, 
Length(FindRec.Name) - 5, 6)) = '.debug') then
+                                       begin
+                                               DebugMsg('RemoveDebugFilesFromDir', '> ' + FindRec.Name);
+                                               DeleteFile(AddBackSlash(pDir) + FindRec.Name);
+                                       end;
+                               end else
+                               begin
+                                       if (FindRec.Name <> '.') and (FindRec.Name <> '..') then
+                                       begin
+                                               SetArrayLength(pDirectories, GetArrayLength(pDirectories) + 
1);
+                                               pDirectories[GetArrayLength(pDirectories) - 1] := 
AddBackSlash(pDir) + FindRec.Name;
+                                       end;
+                               end;
+                       until not FindNext(FindRec);
+               finally
+                       FindClose(FindRec);
+               end;
+       end;
+end;
+
+//remove .debug files from previous installs - there's no built-in way in Inno to recursivly delete files 
with wildcard+extension
+procedure RemoveDebugFiles();
+var Directories: TArrayOfString;
+       Index: Integer;
+begin
+       SetArrayLength(Directories, 1);
+       Directories[0] := ExpandConstant('{app}');
+       Index := 0;
+
+       WizardForm.StatusLabel.Caption := CustomMessage('RemovingOldFiles');
+
+       repeat
+               RemoveDebugFilesFromDir(Directories[Index], Directories);
+               Inc(Index);
+       until Index = GetArrayLength(Directories);
+end;
+
+
 procedure CurStepChanged(pCurStep: TSetupStep);
 begin
        case pCurStep of
+               ssInstall:
+               begin
+                       RemoveDebugFiles();
+               end;
                ssPostInstall:
                begin
                        Associations_Create();
diff --git a/build/windows/installer/lang/setup.isl.in b/build/windows/installer/lang/setup.isl.in
index bde195f..d0f5ac1 100644
--- a/build/windows/installer/lang/setup.isl.in
+++ b/build/windows/installer/lang/setup.isl.in
@@ -99,6 +99,8 @@ _RebootRequiredFirst=Previous GIMP version was removed successfully, but Windows
 ;displayed if restart settings couldn't be read, or if the setup couldn't re-run itself
 _ErrorRestartingSetup=There was an error restarting the Setup. (%1)
 
+_RemovingOldFiles=Cleaning up old files...
+
 ;displayed while the files are being extracted; note the capitalisation!
 _Billboard1=Remember: GIMP is Free Software.%n%nPlease visit
 ;www.gimp.org (displayed between Billboard1 and Billboard2)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]