Fix uninstaller bug to not remove themes files from APPDATA

This commit is contained in:
Don Ho 2016-10-02 14:38:17 +02:00
parent 181b487521
commit f3fcb50015
4 changed files with 72 additions and 69 deletions

View File

@ -111,8 +111,6 @@ Function .onInstSuccess
FunctionEnd FunctionEnd
Var UPDATE_PATH
!include "nsisInclude\mainSectionFuncs.nsh" !include "nsisInclude\mainSectionFuncs.nsh"
Section -"Notepad++" mainSection Section -"Notepad++" mainSection

View File

@ -25,6 +25,7 @@
; 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 UPDATE_PATH
Function setPathAndOptions Function setPathAndOptions
; Set Section properties ; Set Section properties
SetOverwrite on SetOverwrite on
@ -38,7 +39,7 @@ Function setPathAndOptions
${ELSE} ${ELSE}
IfFileExists $INSTDIR\doLocalConf.xml 0 +2 IfFileExists $INSTDIR\doLocalConf.xml 0 +2
Delete $INSTDIR\doLocalConf.xml Delete $INSTDIR\doLocalConf.xml
StrCpy $UPDATE_PATH "$APPDATA\Notepad++" StrCpy $UPDATE_PATH "$APPDATA\${APPNAME}"
CreateDirectory $UPDATE_PATH\plugins\config CreateDirectory $UPDATE_PATH\plugins\config
${EndIf} ${EndIf}
@ -260,10 +261,10 @@ FunctionEnd
Function shortcutLinkManagement Function shortcutLinkManagement
; remove all the npp shortcuts from current user ; remove all the npp shortcuts from current user
Delete "$DESKTOP\Notepad++.lnk" Delete "$DESKTOP\Notepad++.lnk"
Delete "$SMPROGRAMS\Notepad++\Notepad++.lnk" Delete "$SMPROGRAMS\${APPNAME}\Notepad++.lnk"
Delete "$SMPROGRAMS\Notepad++\readme.lnk" Delete "$SMPROGRAMS\${APPNAME}\readme.lnk"
Delete "$SMPROGRAMS\Notepad++\Uninstall.lnk" Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
RMDir "$SMPROGRAMS\Notepad++" RMDir "$SMPROGRAMS\${APPNAME}"
; detect the right of ; detect the right of
UserInfo::GetAccountType UserInfo::GetAccountType
@ -276,8 +277,8 @@ Function shortcutLinkManagement
SetOutPath "$INSTDIR\" SetOutPath "$INSTDIR\"
; add all the npp shortcuts for all user or current user ; add all the npp shortcuts for all user or current user
CreateDirectory "$SMPROGRAMS\Notepad++" CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\Notepad++\Notepad++.lnk" "$INSTDIR\notepad++.exe" CreateShortCut "$SMPROGRAMS\${APPNAME}\Notepad++.lnk" "$INSTDIR\notepad++.exe"
${If} $createShortcutChecked == ${BST_CHECKED} ${If} $createShortcutChecked == ${BST_CHECKED}
CreateShortCut "$DESKTOP\Notepad++.lnk" "$INSTDIR\notepad++.exe" CreateShortCut "$DESKTOP\Notepad++.lnk" "$INSTDIR\notepad++.exe"
${EndIf} ${EndIf}

View File

@ -28,102 +28,102 @@
SectionGroup "Themes" Themes SectionGroup "Themes" Themes
SetOverwrite off SetOverwrite off
${MementoSection} "Black Board" BlackBoard ${MementoSection} "Black Board" BlackBoard
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Black board.xml" File ".\themes\Black board.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Choco" Choco ${MementoSection} "Choco" Choco
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Choco.xml" File ".\themes\Choco.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Hello Kitty" HelloKitty ${MementoSection} "Hello Kitty" HelloKitty
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Hello Kitty.xml" File ".\themes\Hello Kitty.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Mono Industrial" MonoIndustrial ${MementoSection} "Mono Industrial" MonoIndustrial
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Mono Industrial.xml" File ".\themes\Mono Industrial.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Monokai" Monokai ${MementoSection} "Monokai" Monokai
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Monokai.xml" File ".\themes\Monokai.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Obsidian" Obsidian ${MementoSection} "Obsidian" Obsidian
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\obsidian.xml" File ".\themes\obsidian.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Plastic Code Wrap" PlasticCodeWrap ${MementoSection} "Plastic Code Wrap" PlasticCodeWrap
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Plastic Code Wrap.xml" File ".\themes\Plastic Code Wrap.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Ruby Blue" RubyBlue ${MementoSection} "Ruby Blue" RubyBlue
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Ruby Blue.xml" File ".\themes\Ruby Blue.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Twilight" Twilight ${MementoSection} "Twilight" Twilight
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Twilight.xml" File ".\themes\Twilight.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Vibrant Ink" VibrantInk ${MementoSection} "Vibrant Ink" VibrantInk
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Vibrant Ink.xml" File ".\themes\Vibrant Ink.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Deep Black" DeepBlack ${MementoSection} "Deep Black" DeepBlack
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Deep Black.xml" File ".\themes\Deep Black.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "vim Dark Blue" vimDarkBlue ${MementoSection} "vim Dark Blue" vimDarkBlue
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\vim Dark Blue.xml" File ".\themes\vim Dark Blue.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Bespin" Bespin ${MementoSection} "Bespin" Bespin
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Bespin.xml" File ".\themes\Bespin.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Zenburn" Zenburn ${MementoSection} "Zenburn" Zenburn
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Zenburn.xml" File ".\themes\Zenburn.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Solarized" Solarized ${MementoSection} "Solarized" Solarized
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Solarized.xml" File ".\themes\Solarized.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Solarized Light" Solarized-light ${MementoSection} "Solarized Light" Solarized-light
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Solarized-light.xml" File ".\themes\Solarized-light.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Hot Fudge Sundae" HotFudgeSundae ${MementoSection} "Hot Fudge Sundae" HotFudgeSundae
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\HotFudgeSundae.xml" File ".\themes\HotFudgeSundae.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "khaki" khaki ${MementoSection} "khaki" khaki
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\khaki.xml" File ".\themes\khaki.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Mossy Lawn" MossyLawn ${MementoSection} "Mossy Lawn" MossyLawn
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\MossyLawn.xml" File ".\themes\MossyLawn.xml"
${MementoSectionEnd} ${MementoSectionEnd}
${MementoSection} "Navajo" Navajo ${MementoSection} "Navajo" Navajo
SetOutPath "$UPDATE_PATH\themes" SetOutPath "$APPDATA\${APPNAME}\themes"
File ".\themes\Navajo.xml" File ".\themes\Navajo.xml"
${MementoSectionEnd} ${MementoSectionEnd}
SectionGroupEnd SectionGroupEnd
@ -131,83 +131,83 @@ SectionGroupEnd
SectionGroup un.Themes SectionGroup un.Themes
Section un.BlackBoard Section un.BlackBoard
Delete "$UPDATE_PATH\themes\Black board.xml" Delete "$APPDATA\${APPNAME}\themes\Black board.xml"
SectionEnd SectionEnd
Section un.Choco Section un.Choco
Delete "$UPDATE_PATH\themes\Choco.xml" Delete "$APPDATA\${APPNAME}\themes\Choco.xml"
SectionEnd SectionEnd
Section un.HelloKitty Section un.HelloKitty
Delete "$UPDATE_PATH\themes\Hello Kitty.xml" Delete "$APPDATA\${APPNAME}\themes\Hello Kitty.xml"
SectionEnd SectionEnd
Section un.MonoIndustrial Section un.MonoIndustrial
Delete "$UPDATE_PATH\themes\Mono Industrial.xml" Delete "$APPDATA\${APPNAME}\themes\Mono Industrial.xml"
SectionEnd SectionEnd
Section un.Monokai Section un.Monokai
Delete "$UPDATE_PATH\themes\Monokai.xml" Delete "$APPDATA\${APPNAME}\themes\Monokai.xml"
SectionEnd SectionEnd
Section un.Obsidian Section un.Obsidian
Delete "$UPDATE_PATH\themes/obsidian.xml" Delete "$APPDATA\${APPNAME}\themes\obsidian.xml"
SectionEnd SectionEnd
Section un.PlasticCodeWrap Section un.PlasticCodeWrap
Delete "$UPDATE_PATH\themes\Plastic Code Wrap.xml" Delete "$APPDATA\${APPNAME}\themes\Plastic Code Wrap.xml"
SectionEnd SectionEnd
Section un.RubyBlue Section un.RubyBlue
Delete "$UPDATE_PATH\themes\Ruby Blue.xml" Delete "$APPDATA\${APPNAME}\themes\Ruby Blue.xml"
SectionEnd SectionEnd
Section un.Twilight Section un.Twilight
Delete "$UPDATE_PATH\themes\Twilight.xml" Delete "$APPDATA\${APPNAME}\themes\Twilight.xml"
SectionEnd SectionEnd
Section un.VibrantInk Section un.VibrantInk
Delete "$UPDATE_PATH\themes\Vibrant Ink.xml" Delete "$APPDATA\${APPNAME}\themes\Vibrant Ink.xml"
SectionEnd SectionEnd
Section un.DeepBlack Section un.DeepBlack
Delete "$UPDATE_PATH\themes\Deep Black.xml" Delete "$APPDATA\${APPNAME}\themes\Deep Black.xml"
SectionEnd SectionEnd
Section un.vimDarkBlue Section un.vimDarkBlue
Delete "$UPDATE_PATH\themes\vim Dark Blue.xml" Delete "$APPDATA\${APPNAME}\themes\vim Dark Blue.xml"
SectionEnd SectionEnd
Section un.Bespin Section un.Bespin
Delete "$UPDATE_PATH\themes\Bespin.xml" Delete "$APPDATA\${APPNAME}\themes\Bespin.xml"
SectionEnd SectionEnd
Section un.Zenburn Section un.Zenburn
Delete "$UPDATE_PATH\themes\Zenburn.xml" Delete "$APPDATA\${APPNAME}\themes\Zenburn.xml"
SectionEnd SectionEnd
Section un.Solarized Section un.Solarized
Delete "$UPDATE_PATH\themes\Solarized.xml" Delete "$APPDATA\${APPNAME}\themes\Solarized.xml"
SectionEnd SectionEnd
Section un.Solarized-light Section un.Solarized-light
Delete "$UPDATE_PATH\themes\Solarized-light.xml" Delete "$APPDATA\${APPNAME}\themes\Solarized-light.xml"
SectionEnd SectionEnd
Section un.HotFudgeSundae Section un.HotFudgeSundae
Delete "$UPDATE_PATH\themes\HotFudgeSundae.xml" Delete "$APPDATA\${APPNAME}\themes\HotFudgeSundae.xml"
SectionEnd SectionEnd
Section un.khaki Section un.khaki
Delete "$UPDATE_PATH\themes\khaki.xml" Delete "$APPDATA\${APPNAME}\themes\khaki.xml"
SectionEnd SectionEnd
Section un.MossyLawn Section un.MossyLawn
Delete "$UPDATE_PATH\themes\MossyLawn.xml" Delete "$APPDATA\${APPNAME}\themes\MossyLawn.xml"
SectionEnd SectionEnd
Section un.Navajo Section un.Navajo
Delete "$UPDATE_PATH\themes\Navajo.xml" Delete "$APPDATA\${APPNAME}\themes\Navajo.xml"
SectionEnd SectionEnd
SectionGroupEnd SectionGroupEnd

View File

@ -115,17 +115,17 @@ Section Uninstall
Delete "$INSTDIR\uninstall.exe" Delete "$INSTDIR\uninstall.exe"
; Delete Shortcuts ; Delete Shortcuts
Delete "$SMPROGRAMS\Notepad++\Uninstall.lnk" Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
RMDir "$SMPROGRAMS\Notepad++" RMDir "$SMPROGRAMS\${APPNAME}"
UserInfo::GetAccountType UserInfo::GetAccountType
Pop $1 Pop $1
StrCmp $1 "Admin" 0 +2 StrCmp $1 "Admin" 0 +2
SetShellVarContext all SetShellVarContext all ; make context for all user
Delete "$DESKTOP\Notepad++.lnk" Delete "$DESKTOP\Notepad++.lnk"
Delete "$SMPROGRAMS\Notepad++\Notepad++.lnk" Delete "$SMPROGRAMS\${APPNAME}\Notepad++.lnk"
Delete "$SMPROGRAMS\Notepad++\readme.lnk" Delete "$SMPROGRAMS\${APPNAME}\readme.lnk"
; Clean up Notepad++ ; Clean up Notepad++
@ -154,24 +154,29 @@ Section Uninstall
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"
SetShellVarContext current
Delete "$APPDATA\Notepad++\langs.xml"
Delete "$APPDATA\Notepad++\config.xml"
Delete "$APPDATA\Notepad++\stylers.xml"
Delete "$APPDATA\Notepad++\contextMenu.xml"
Delete "$APPDATA\Notepad++\shortcuts.xml"
Delete "$APPDATA\Notepad++\functionList.xml"
Delete "$APPDATA\Notepad++\nativeLang.xml"
Delete "$APPDATA\Notepad++\session.xml"
Delete "$APPDATA\Notepad++\insertExt.ini"
IfFileExists "$INSTDIR\NppHelp.chm" 0 +2
Delete "$INSTDIR\NppHelp.chm" Delete "$INSTDIR\NppHelp.chm"
RMDir "$APPDATA\Notepad++" ; 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}"
StrCmp $1 "Admin" 0 +2 StrCmp $1 "Admin" 0 +2
SetShellVarContext all SetShellVarContext all ; make context for all user
; Remove remaining directories ; Remove remaining directories
RMDir /r "$INSTDIR\plugins\disabled\" RMDir /r "$INSTDIR\plugins\disabled\"
@ -180,8 +185,7 @@ Section Uninstall
RMDir "$INSTDIR\themes\" RMDir "$INSTDIR\themes\"
RMDir "$INSTDIR\localization\" RMDir "$INSTDIR\localization\"
RMDir "$INSTDIR\" RMDir "$INSTDIR\"
RMDir "$SMPROGRAMS\Notepad++" RMDir "$SMPROGRAMS\${APPNAME}"
RMDir "$APPDATA\Notepad++"
SectionEnd SectionEnd