Ask user for keeping userr data during uninstallation

This commit is contained in:
Don Ho 2016-10-04 17:58:08 +02:00
parent 5c031d9f81
commit bb01b0f528
2 changed files with 108 additions and 37 deletions

View File

@ -135,83 +135,123 @@ SectionGroupEnd
SectionGroup un.Themes
Section un.BlackBoard
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Black board.xml"
${endIf}
SectionEnd
Section un.Choco
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Choco.xml"
${endIf}
SectionEnd
Section un.HelloKitty
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Hello Kitty.xml"
${endIf}
SectionEnd
Section un.MonoIndustrial
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Mono Industrial.xml"
${endIf}
SectionEnd
Section un.Monokai
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Monokai.xml"
${endIf}
SectionEnd
Section un.Obsidian
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\obsidian.xml"
${endIf}
SectionEnd
Section un.PlasticCodeWrap
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Plastic Code Wrap.xml"
${endIf}
SectionEnd
Section un.RubyBlue
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Ruby Blue.xml"
${endIf}
SectionEnd
Section un.Twilight
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Twilight.xml"
${endIf}
SectionEnd
Section un.VibrantInk
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Vibrant Ink.xml"
${endIf}
SectionEnd
Section un.DeepBlack
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Deep Black.xml"
${endIf}
SectionEnd
Section un.vimDarkBlue
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\vim Dark Blue.xml"
${endIf}
SectionEnd
Section un.Bespin
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Bespin.xml"
${endIf}
SectionEnd
Section un.Zenburn
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Zenburn.xml"
${endIf}
SectionEnd
Section un.Solarized
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Solarized.xml"
${endIf}
SectionEnd
Section un.Solarized-light
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Solarized-light.xml"
${endIf}
SectionEnd
Section un.HotFudgeSundae
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\HotFudgeSundae.xml"
${endIf}
SectionEnd
Section un.khaki
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\khaki.xml"
${endIf}
SectionEnd
Section un.MossyLawn
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\MossyLawn.xml"
${endIf}
SectionEnd
Section un.Navajo
${If} $keepUserData == "false"
Delete "$themesParentPath\themes\Navajo.xml"
${endIf}
SectionEnd
SectionGroupEnd

View File

@ -25,6 +25,21 @@
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Var themesParentPath
Var doLocalConf
Function un.onInit
; determinate theme path for uninstall themes
StrCpy $themesParentPath "$APPDATA\${APPNAME}"
StrCpy $doLocalConf "false"
IfFileExists $INSTDIR\doLocalConf.xml doesExist noneExist
doesExist:
StrCpy $themesParentPath $INSTDIR
StrCpy $doLocalConf "true"
noneExist:
;MessageBox MB_OK "doLocalConf == $doLocalConf"
FunctionEnd
Section un.explorerContextMenu
Exec 'regsvr32 /u /s "$INSTDIR\NppShell_01.dll"'
Exec 'regsvr32 /u /s "$INSTDIR\NppShell_02.dll"'
@ -100,6 +115,16 @@ Section un.UserManual
RMDir /r "$INSTDIR\user.manual"
SectionEnd
Var keepUserData
Function un.doYouReallyWantToKeepData
StrCpy $keepUserData "false"
MessageBox MB_YESNO "Would you like to keep your custom settings?" IDYES skipRemoveUserData IDNO removeUserData
skipRemoveUserData:
StrCpy $keepUserData "true"
removeUserData:
FunctionEnd
Section Uninstall
!ifdef ARCH64
SetRegView 64
@ -129,7 +154,6 @@ Section Uninstall
; Clean up Notepad++
Delete "$INSTDIR\LINEDRAW.TTF"
Delete "$INSTDIR\SciLexer.dll"
Delete "$INSTDIR\change.log"
Delete "$INSTDIR\LICENSE"
@ -137,47 +161,62 @@ Section Uninstall
Delete "$INSTDIR\notepad++.exe"
Delete "$INSTDIR\readme.txt"
Delete "$INSTDIR\config.xml"
${If} $doLocalConf == "true"
Call un.doYouReallyWantToKeepData
${endIf}
${If} $keepUserData == "false"
Delete "$INSTDIR\config.xml"
Delete "$INSTDIR\langs.xml"
Delete "$INSTDIR\stylers.xml"
Delete "$INSTDIR\contextMenu.xml"
Delete "$INSTDIR\shortcuts.xml"
Delete "$INSTDIR\functionList.xml"
Delete "$INSTDIR\session.xml"
Delete "$INSTDIR\nativeLang.xml"
Delete "$INSTDIR\userDefineLang.xml"
${endIf}
Delete "$INSTDIR\config.model.xml"
Delete "$INSTDIR\langs.xml"
Delete "$INSTDIR\langs.model.xml"
Delete "$INSTDIR\stylers.xml"
Delete "$INSTDIR\stylers.model.xml"
Delete "$INSTDIR\stylers_remove.xml"
Delete "$INSTDIR\contextMenu.xml"
Delete "$INSTDIR\shortcuts.xml"
Delete "$INSTDIR\functionList.xml"
Delete "$INSTDIR\nativeLang.xml"
Delete "$INSTDIR\session.xml"
Delete "$INSTDIR\localization\english.xml"
Delete "$INSTDIR\LINEDRAW.TTF"
Delete "$INSTDIR\SourceCodePro-Regular.ttf"
Delete "$INSTDIR\SourceCodePro-Bold.ttf"
Delete "$INSTDIR\SourceCodePro-It.ttf"
Delete "$INSTDIR\SourceCodePro-BoldIt.ttf"
Delete "$INSTDIR\NppHelp.chm"
Delete "$INSTDIR\doLocalConf.xml"
; make context as current user to uninstall user's APPDATA
SetShellVarContext current
Delete "$APPDATA\${APPNAME}\langs.xml"
Delete "$APPDATA\${APPNAME}\config.xml"
Delete "$APPDATA\${APPNAME}\stylers.xml"
Delete "$APPDATA\${APPNAME}\contextMenu.xml"
Delete "$APPDATA\${APPNAME}\shortcuts.xml"
Delete "$APPDATA\${APPNAME}\functionList.xml"
Delete "$APPDATA\${APPNAME}\nativeLang.xml"
Delete "$APPDATA\${APPNAME}\session.xml"
Delete "$APPDATA\${APPNAME}\userDefineLang.xml"
Delete "$APPDATA\${APPNAME}\insertExt.ini"
RMDir /r "$APPDATA\${APPNAME}\plugins\"
RMDir "$APPDATA\${APPNAME}\backup\"
RMDir "$APPDATA\${APPNAME}\themes\"
RMDir "$APPDATA\${APPNAME}"
${If} $doLocalConf == "false"
Call un.doYouReallyWantToKeepData
${endIf}
${If} $keepUserData == "false"
; make context as current user to uninstall user's APPDATA
SetShellVarContext current
Delete "$APPDATA\${APPNAME}\langs.xml"
Delete "$APPDATA\${APPNAME}\config.xml"
Delete "$APPDATA\${APPNAME}\stylers.xml"
Delete "$APPDATA\${APPNAME}\contextMenu.xml"
Delete "$APPDATA\${APPNAME}\shortcuts.xml"
Delete "$APPDATA\${APPNAME}\functionList.xml"
Delete "$APPDATA\${APPNAME}\nativeLang.xml"
Delete "$APPDATA\${APPNAME}\session.xml"
Delete "$APPDATA\${APPNAME}\userDefineLang.xml"
Delete "$APPDATA\${APPNAME}\insertExt.ini"
StrCmp $1 "Admin" 0 +2
SetShellVarContext all ; make context for all user
RMDir /r "$APPDATA\${APPNAME}\plugins\"
RMDir "$APPDATA\${APPNAME}\backup\"
RMDir "$APPDATA\${APPNAME}\themes\"
RMDir "$APPDATA\${APPNAME}"
StrCmp $1 "Admin" 0 +2
SetShellVarContext all ; make context for all user
${endIf}
; Remove remaining directories
RMDir /r "$INSTDIR\plugins\disabled\"
RMDir "$INSTDIR\plugins\APIs\"
@ -189,12 +228,4 @@ Section Uninstall
SectionEnd
Var themesParentPath
Function un.onInit
; determinate theme path for uninstall themes
StrCpy $themesParentPath "$APPDATA\${APPNAME}"
IfFileExists $INSTDIR\doLocalConf.xml doesExist noneExist
doesExist:
StrCpy $themesParentPath $INSTDIR
noneExist:
FunctionEnd