Hello,

The changes found in this patch make the GUB Windows uninstallers
*much* faster.  Before, uninstalling LilyPond on Windows could take up
to 10 minutes, and these changes appear to have cut that time down to
about 20 seconds.

As the commit description notes, I incorporated the recent script
improvements from this wiki page:
http://nsis.sourceforge.net/Uninstall_only_installed_files

Let me know if there are any problems.

Thanks,
Patrick
From eadbbae85fa146c57e806b98a96653987c1635af Mon Sep 17 00:00:00 2001
From: Patrick McCarty <[email protected]>
Date: Sat, 10 Jul 2010 20:44:02 -0700
Subject: [PATCH] NSIS: Speed up uninstallers.

Taken (and slightly adapted) from the latest revision of the code on
this page:

http://nsis.sourceforge.net/Uninstall_only_installed_files
---
 nsis/denemo.nsi    |   34 ++++++++++++++++------------------
 nsis/git.nsi       |   34 ++++++++++++++++------------------
 nsis/installer.nsi |   34 ++++++++++++++++------------------
 nsis/lilypond.nsi  |   34 ++++++++++++++++------------------
 4 files changed, 64 insertions(+), 72 deletions(-)

diff --git a/nsis/denemo.nsi b/nsis/denemo.nsi
index 2162409..30de321 100644
--- a/nsis/denemo.nsi
+++ b/nsis/denemo.nsi
@@ -128,31 +128,29 @@ Function un.install_installed_files
  Push $R2
  SetFileAttributes "$INSTDIR\${UninstLog}" NORMAL
  FileOpen $UninstLog "$INSTDIR\${UninstLog}" r
- StrCpy $R1 0
+ StrCpy $R1 -1
 
  GetLineCount:
   ClearErrors
-   FileRead $UninstLog $R0
-   IntOp $R1 $R1 + 1
-   IfErrors 0 GetLineCount
+  FileRead $UninstLog $R0
+  IntOp $R1 $R1 + 1
+  StrCpy $R0 "$INSTDIR\$R0" -2
+  Push $R0
+  IfErrors 0 GetLineCount
+
+ Pop $R0
 
  LoopRead:
-  FileSeek $UninstLog 0 SET
-  StrCpy $R2 0
-  FindLine:
-   FileRead $UninstLog $R0
-   IntOp $R2 $R2 + 1
-   StrCmp $R1 $R2 0 FindLine
-
-   StrCpy $R0 "$INSTDIR\$R0" -2
-   IfFileExists "$R0\*.*" 0 +3
-    RMDir $R0  #is dir
-   Goto +3
-   IfFileExists "$R0" 0 +2
-    Delete "$R0" #is file
+  StrCmp $R1 0 LoopDone
+  Pop $R0
+
+  IfFileExists "$R0\*.*" 0 +3
+   RMDir $R0  #is dir
+  Goto +3
+  IfFileExists "$R0" 0 +2
+   Delete "$R0" #is file
 
   IntOp $R1 $R1 - 1
-  StrCmp $R1 0 LoopDone
   Goto LoopRead
  LoopDone:
  FileClose $UninstLog
diff --git a/nsis/git.nsi b/nsis/git.nsi
index a0ea17e..82c32d0 100644
--- a/nsis/git.nsi
+++ b/nsis/git.nsi
@@ -115,31 +115,29 @@ Function un.install_installed_files
  Push $R2
  SetFileAttributes "$INSTDIR\${UninstLog}" NORMAL
  FileOpen $UninstLog "$INSTDIR\${UninstLog}" r
- StrCpy $R1 0
+ StrCpy $R1 -1
 
  GetLineCount:
   ClearErrors
-   FileRead $UninstLog $R0
-   IntOp $R1 $R1 + 1
-   IfErrors 0 GetLineCount
+  FileRead $UninstLog $R0
+  IntOp $R1 $R1 + 1
+  StrCpy $R0 "$INSTDIR\$R0" -2
+  Push $R0
+  IfErrors 0 GetLineCount
+
+ Pop $R0
 
  LoopRead:
-  FileSeek $UninstLog 0 SET
-  StrCpy $R2 0
-  FindLine:
-   FileRead $UninstLog $R0
-   IntOp $R2 $R2 + 1
-   StrCmp $R1 $R2 0 FindLine
-
-   StrCpy $R0 "$INSTDIR\$R0" -2
-   IfFileExists "$R0\*.*" 0 +3
-    RMDir $R0  #is dir
-   Goto +3
-   IfFileExists "$R0" 0 +2
-    Delete "$R0" #is file
+  StrCmp $R1 0 LoopDone
+  Pop $R0
+
+  IfFileExists "$R0\*.*" 0 +3
+   RMDir $R0  #is dir
+  Goto +3
+  IfFileExists "$R0" 0 +2
+   Delete "$R0" #is file
 
   IntOp $R1 $R1 - 1
-  StrCmp $R1 0 LoopDone
   Goto LoopRead
  LoopDone:
  FileClose $UninstLog
diff --git a/nsis/installer.nsi b/nsis/installer.nsi
index fb028f7..47f1d9c 100644
--- a/nsis/installer.nsi
+++ b/nsis/installer.nsi
@@ -113,31 +113,29 @@ Function un.install_installed_files
  Push $R2
  SetFileAttributes "$INSTDIR\${UninstLog}" NORMAL
  FileOpen $UninstLog "$INSTDIR\${UninstLog}" r
- StrCpy $R1 0
+ StrCpy $R1 -1
 
  GetLineCount:
   ClearErrors
-   FileRead $UninstLog $R0
-   IntOp $R1 $R1 + 1
-   IfErrors 0 GetLineCount
+  FileRead $UninstLog $R0
+  IntOp $R1 $R1 + 1
+  StrCpy $R0 "$INSTDIR\$R0" -2
+  Push $R0
+  IfErrors 0 GetLineCount
+
+ Pop $R0
 
  LoopRead:
-  FileSeek $UninstLog 0 SET
-  StrCpy $R2 0
-  FindLine:
-   FileRead $UninstLog $R0
-   IntOp $R2 $R2 + 1
-   StrCmp $R1 $R2 0 FindLine
-
-   StrCpy $R0 "$INSTDIR\$R0" -2
-   IfFileExists "$R0\*.*" 0 +3
-    RMDir $R0  #is dir
-   Goto +3
-   IfFileExists "$R0" 0 +2
-    Delete "$R0" #is file
+  StrCmp $R1 0 LoopDone
+  Pop $R0
+
+  IfFileExists "$R0\*.*" 0 +3
+   RMDir $R0  #is dir
+  Goto +3
+  IfFileExists "$R0" 0 +2
+   Delete "$R0" #is file
 
   IntOp $R1 $R1 - 1
-  StrCmp $R1 0 LoopDone
   Goto LoopRead
  LoopDone:
  FileClose $UninstLog
diff --git a/nsis/lilypond.nsi b/nsis/lilypond.nsi
index 8d3c3f8..07884f2 100644
--- a/nsis/lilypond.nsi
+++ b/nsis/lilypond.nsi
@@ -180,31 +180,29 @@ Function un.install_installed_files
  Push $R2
  SetFileAttributes "$INSTDIR\${UninstLog}" NORMAL
  FileOpen $UninstLog "$INSTDIR\${UninstLog}" r
- StrCpy $R1 0
+ StrCpy $R1 -1
 
  GetLineCount:
   ClearErrors
-   FileRead $UninstLog $R0
-   IntOp $R1 $R1 + 1
-   IfErrors 0 GetLineCount
+  FileRead $UninstLog $R0
+  IntOp $R1 $R1 + 1
+  StrCpy $R0 "$INSTDIR\$R0" -2
+  Push $R0
+  IfErrors 0 GetLineCount
+
+ Pop $R0
 
  LoopRead:
-  FileSeek $UninstLog 0 SET
-  StrCpy $R2 0
-  FindLine:
-   FileRead $UninstLog $R0
-   IntOp $R2 $R2 + 1
-   StrCmp $R1 $R2 0 FindLine
-
-   StrCpy $R0 "$INSTDIR\$R0" -2
-   IfFileExists "$R0\*.*" 0 +3
-    RMDir $R0  #is dir
-   Goto +3
-   IfFileExists "$R0" 0 +2
-    Delete "$R0" #is file
+  StrCmp $R1 0 LoopDone
+  Pop $R0
+
+  IfFileExists "$R0\*.*" 0 +3
+   RMDir $R0  #is dir
+  Goto +3
+  IfFileExists "$R0" 0 +2
+   Delete "$R0" #is file
 
   IntOp $R1 $R1 - 1
-  StrCmp $R1 0 LoopDone
   Goto LoopRead
  LoopDone:
  FileClose $UninstLog
-- 
1.7.1.1

_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to