QGIS/win_build/RecursiveDelete.nsh
timlinux 6887df0978 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
2006-12-09 02:22:35 +00:00

60 lines
1.8 KiB
NSIS

; ################################################################
; appends \ to the path if missing
; example: !insertmacro GetCleanDir "c:\blabla"
; Pop $0 => "c:\blabla\"
!macro GetCleanDir INPUTDIR
; ATTENTION: USE ON YOUR OWN RISK!
; Please report bugs here: http://stefan.bertels.org/
!define Index_GetCleanDir 'GetCleanDir_Line${__LINE__}'
Push $R0
Push $R1
StrCpy $R0 "${INPUTDIR}"
StrCmp $R0 "" ${Index_GetCleanDir}-finish
StrCpy $R1 "$R0" "" -1
StrCmp "$R1" "\" ${Index_GetCleanDir}-finish
StrCpy $R0 "$R0\"
${Index_GetCleanDir}-finish:
Pop $R1
Exch $R0
!undef Index_GetCleanDir
!macroend
; ################################################################
; similar to "RMDIR /r DIRECTORY", but does not remove DIRECTORY itself
; example: !insertmacro RemoveFilesAndSubDirs "$INSTDIR"
!macro RemoveFilesAndSubDirs DIRECTORY
; ATTENTION: USE ON YOUR OWN RISK!
; Please report bugs here: http://stefan.bertels.org/
!define Index_RemoveFilesAndSubDirs 'RemoveFilesAndSubDirs_${__LINE__}'
Push $R0
Push $R1
Push $R2
!insertmacro GetCleanDir "${DIRECTORY}"
Pop $R2
FindFirst $R0 $R1 "$R2*.*"
${Index_RemoveFilesAndSubDirs}-loop:
StrCmp $R1 "" ${Index_RemoveFilesAndSubDirs}-done
StrCmp $R1 "." ${Index_RemoveFilesAndSubDirs}-next
StrCmp $R1 ".." ${Index_RemoveFilesAndSubDirs}-next
IfFileExists "$R2$R1\*.*" ${Index_RemoveFilesAndSubDirs}-directory
; file
Delete "$R2$R1"
goto ${Index_RemoveFilesAndSubDirs}-next
${Index_RemoveFilesAndSubDirs}-directory:
; directory
RMDir /r "$R2$R1"
${Index_RemoveFilesAndSubDirs}-next:
FindNext $R0 $R1
Goto ${Index_RemoveFilesAndSubDirs}-loop
${Index_RemoveFilesAndSubDirs}-done:
FindClose $R0
Pop $R2
Pop $R1
Pop $R0
!undef Index_RemoveFilesAndSubDirs
!macroend