Skip to content

Commit 6887df0

Browse files
author
timlinux
committedDec 9, 2006
Added recursive delete function and fixed bug where uninstaller was not properly removing all of qgis (why anyone would want to remove it anyway is beyond me...)
Added RecursiveDelete.nsh to assist in above fix Renamed qgis_window_geometry.nsi to qgis_window_geometry.nsh for better file nameing consistency git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6222 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

4 files changed

+80
-22
lines changed

4 files changed

+80
-22
lines changed
 

‎win_build/RecursiveDelete.nsh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
; ################################################################
3+
; appends \ to the path if missing
4+
; example: !insertmacro GetCleanDir "c:\blabla"
5+
; Pop $0 => "c:\blabla\"
6+
!macro GetCleanDir INPUTDIR
7+
; ATTENTION: USE ON YOUR OWN RISK!
8+
; Please report bugs here: http://stefan.bertels.org/
9+
!define Index_GetCleanDir 'GetCleanDir_Line${__LINE__}'
10+
Push $R0
11+
Push $R1
12+
StrCpy $R0 "${INPUTDIR}"
13+
StrCmp $R0 "" ${Index_GetCleanDir}-finish
14+
StrCpy $R1 "$R0" "" -1
15+
StrCmp "$R1" "\" ${Index_GetCleanDir}-finish
16+
StrCpy $R0 "$R0\"
17+
${Index_GetCleanDir}-finish:
18+
Pop $R1
19+
Exch $R0
20+
!undef Index_GetCleanDir
21+
!macroend
22+
23+
; ################################################################
24+
; similar to "RMDIR /r DIRECTORY", but does not remove DIRECTORY itself
25+
; example: !insertmacro RemoveFilesAndSubDirs "$INSTDIR"
26+
!macro RemoveFilesAndSubDirs DIRECTORY
27+
; ATTENTION: USE ON YOUR OWN RISK!
28+
; Please report bugs here: http://stefan.bertels.org/
29+
!define Index_RemoveFilesAndSubDirs 'RemoveFilesAndSubDirs_${__LINE__}'
30+
31+
Push $R0
32+
Push $R1
33+
Push $R2
34+
35+
!insertmacro GetCleanDir "${DIRECTORY}"
36+
Pop $R2
37+
FindFirst $R0 $R1 "$R2*.*"
38+
${Index_RemoveFilesAndSubDirs}-loop:
39+
StrCmp $R1 "" ${Index_RemoveFilesAndSubDirs}-done
40+
StrCmp $R1 "." ${Index_RemoveFilesAndSubDirs}-next
41+
StrCmp $R1 ".." ${Index_RemoveFilesAndSubDirs}-next
42+
IfFileExists "$R2$R1\*.*" ${Index_RemoveFilesAndSubDirs}-directory
43+
; file
44+
Delete "$R2$R1"
45+
goto ${Index_RemoveFilesAndSubDirs}-next
46+
${Index_RemoveFilesAndSubDirs}-directory:
47+
; directory
48+
RMDir /r "$R2$R1"
49+
${Index_RemoveFilesAndSubDirs}-next:
50+
FindNext $R0 $R1
51+
Goto ${Index_RemoveFilesAndSubDirs}-loop
52+
${Index_RemoveFilesAndSubDirs}-done:
53+
FindClose $R0
54+
55+
Pop $R2
56+
Pop $R1
57+
Pop $R0
58+
!undef Index_RemoveFilesAndSubDirs
59+
!macroend

‎win_build/qgis-debug.nsi

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
SetCompressor zlib
1414
; Added by Tim for setting env vars (see this file on disk)
1515
!include WriteEnvStr.nsh
16+
;Added by Tim for a macro that will recursively delete the files in the install dir
17+
!include RecursiveDelete.nsh
1618

1719
; MUI 1.67 compatible ------
1820
!include "MUI.nsh"
@@ -85,7 +87,7 @@ ShowInstDetails show
8587
ShowUnInstDetails show
8688

8789
Section "MainSection" SEC01
88-
!include qgis_window_geometry.nsi
90+
!include qgis_window_geometry.nsh
8991
SetOutPath "$INSTDIR"
9092
SetOverwrite try
9193
;------- Qt
@@ -178,23 +180,20 @@ Section Uninstall
178180
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
179181
Delete "$INSTDIR\${PRODUCT_NAME}.url"
180182
Delete "$INSTDIR\uninst-debug.exe"
181-
Delete "$INSTDIR\*.exe"
182-
Delete "$INSTDIR\*.dll"
183-
Delete "$INSTDIR\*.csv"
184-
;----------------- subdirs
185-
RMDir /r "$INSTDIR/grass"
186-
RMDir /r "$INSTDIR/lib"
187-
RMDir /r "$INSTDIR/share"
188-
RMDir /r "$INSTDIR/nad"
189-
RMDir /r "$INSTDIR/msys"
183+
190184
;----------------- icons and shortcuts
191185
Delete "$SMPROGRAMS\$ICONS_GROUP\UninstallDebug.lnk"
192186
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
193187
Delete "$DESKTOP\Quantum GIS Debug.lnk"
194188
Delete "$SMPROGRAMS\$ICONS_GROUP\Quantum GIS Debug.lnk"
195189
RMDir "$SMPROGRAMS\$ICONS_GROUP"
196190

197-
;RMDir "$INSTDIR\plugins"
191+
192+
;----------------- The application dir gets zapped next ...
193+
;I added this recursive delte implementation because
194+
; RM -R wasnt working properly
195+
Push "$INSTDIR"
196+
!insertmacro RemoveFilesAndSubDirs "$INSTDIR\"
198197
RMDir "$INSTDIR"
199198

200199

‎win_build/qgis.nsi

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
SetCompressor zlib
1414
; Added by Tim for setting env vars (see this file on disk)
1515
!include WriteEnvStr.nsh
16+
;Added by Tim for a macro that will recursively delete the files in the install dir
17+
!include RecursiveDelete.nsh
1618

1719
; MUI 1.67 compatible ------
1820
!include "MUI.nsh"
@@ -85,7 +87,7 @@ ShowUnInstDetails show
8587

8688
Section "MainSection" SEC01
8789
;Set the reg key so we get default toolbar layout
88-
!include qgis_window_geometry.nsi
90+
!include qgis_window_geometry.nsh
8991
SetOutPath "$INSTDIR"
9092
SetOverwrite try
9193
;------- Qt
@@ -170,6 +172,7 @@ Function un.onInit
170172
Abort
171173
FunctionEnd
172174

175+
173176
Section Uninstall
174177
# remove the variable
175178
Push PROJ_LIB
@@ -178,27 +181,24 @@ Section Uninstall
178181
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
179182
Delete "$INSTDIR\${PRODUCT_NAME}.url"
180183
Delete "$INSTDIR\uninst.exe"
181-
Delete "$INSTDIR\*.exe"
182-
Delete "$INSTDIR\*.dll"
183-
Delete "$INSTDIR\*.csv"
184-
;----------------- subdirs
185-
RMDir /r "$INSTDIR/grass"
186-
RMDir /r "$INSTDIR/lib"
187-
RMDir /r "$INSTDIR/share"
188-
RMDir /r "$INSTDIR/nad"
189-
RMDir /r "$INSTDIR/msys"
184+
190185
;----------------- icons and shortcuts
191186
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
192187
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
193188
Delete "$DESKTOP\Quantum GIS.lnk"
194189
Delete "$SMPROGRAMS\$ICONS_GROUP\Quantum GIS.lnk"
195190
RMDir "$SMPROGRAMS\$ICONS_GROUP"
196191

197-
;RMDir "$INSTDIR\plugins"
192+
;----------------- The application dir gets zapped next ...
193+
;I added this recursive delte implementation because
194+
; RM -R wasnt working properly
195+
Push "$INSTDIR"
196+
!insertmacro RemoveFilesAndSubDirs "$INSTDIR\"
198197
RMDir "$INSTDIR"
199198

200199

201200
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
202201
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
203202
SetAutoClose true
204203
SectionEnd
204+

0 commit comments

Comments
 (0)
Please sign in to comment.