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

View File

@ -25,6 +25,21 @@
; along with this program; if not, write to the Free Software ; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; 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 Section un.explorerContextMenu
Exec 'regsvr32 /u /s "$INSTDIR\NppShell_01.dll"' Exec 'regsvr32 /u /s "$INSTDIR\NppShell_01.dll"'
Exec 'regsvr32 /u /s "$INSTDIR\NppShell_02.dll"' Exec 'regsvr32 /u /s "$INSTDIR\NppShell_02.dll"'
@ -100,6 +115,16 @@ Section un.UserManual
RMDir /r "$INSTDIR\user.manual" RMDir /r "$INSTDIR\user.manual"
SectionEnd 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 Section Uninstall
!ifdef ARCH64 !ifdef ARCH64
SetRegView 64 SetRegView 64
@ -129,7 +154,6 @@ Section Uninstall
; Clean up Notepad++ ; Clean up Notepad++
Delete "$INSTDIR\LINEDRAW.TTF"
Delete "$INSTDIR\SciLexer.dll" Delete "$INSTDIR\SciLexer.dll"
Delete "$INSTDIR\change.log" Delete "$INSTDIR\change.log"
Delete "$INSTDIR\LICENSE" Delete "$INSTDIR\LICENSE"
@ -137,47 +161,62 @@ Section Uninstall
Delete "$INSTDIR\notepad++.exe" Delete "$INSTDIR\notepad++.exe"
Delete "$INSTDIR\readme.txt" 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\config.model.xml"
Delete "$INSTDIR\langs.xml"
Delete "$INSTDIR\langs.model.xml" Delete "$INSTDIR\langs.model.xml"
Delete "$INSTDIR\stylers.xml"
Delete "$INSTDIR\stylers.model.xml" Delete "$INSTDIR\stylers.model.xml"
Delete "$INSTDIR\stylers_remove.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\localization\english.xml"
Delete "$INSTDIR\LINEDRAW.TTF"
Delete "$INSTDIR\SourceCodePro-Regular.ttf" Delete "$INSTDIR\SourceCodePro-Regular.ttf"
Delete "$INSTDIR\SourceCodePro-Bold.ttf" Delete "$INSTDIR\SourceCodePro-Bold.ttf"
Delete "$INSTDIR\SourceCodePro-It.ttf" Delete "$INSTDIR\SourceCodePro-It.ttf"
Delete "$INSTDIR\SourceCodePro-BoldIt.ttf" Delete "$INSTDIR\SourceCodePro-BoldIt.ttf"
Delete "$INSTDIR\NppHelp.chm" Delete "$INSTDIR\NppHelp.chm"
Delete "$INSTDIR\doLocalConf.xml"
; make context as current user to uninstall user's APPDATA ${If} $doLocalConf == "false"
SetShellVarContext current Call un.doYouReallyWantToKeepData
Delete "$APPDATA\${APPNAME}\langs.xml" ${endIf}
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} $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 RMDir /r "$APPDATA\${APPNAME}\plugins\"
SetShellVarContext all ; make context for all user 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 ; Remove remaining directories
RMDir /r "$INSTDIR\plugins\disabled\" RMDir /r "$INSTDIR\plugins\disabled\"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
@ -189,12 +228,4 @@ Section Uninstall
SectionEnd 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