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
Var UPDATE_PATH
!include "nsisInclude\mainSectionFuncs.nsh"
Section -"Notepad++" mainSection

View File

@ -25,6 +25,7 @@
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Var UPDATE_PATH
Function setPathAndOptions
; Set Section properties
SetOverwrite on
@ -38,7 +39,7 @@ Function setPathAndOptions
${ELSE}
IfFileExists $INSTDIR\doLocalConf.xml 0 +2
Delete $INSTDIR\doLocalConf.xml
StrCpy $UPDATE_PATH "$APPDATA\Notepad++"
StrCpy $UPDATE_PATH "$APPDATA\${APPNAME}"
CreateDirectory $UPDATE_PATH\plugins\config
${EndIf}
@ -260,10 +261,10 @@ FunctionEnd
Function shortcutLinkManagement
; remove all the npp shortcuts from current user
Delete "$DESKTOP\Notepad++.lnk"
Delete "$SMPROGRAMS\Notepad++\Notepad++.lnk"
Delete "$SMPROGRAMS\Notepad++\readme.lnk"
Delete "$SMPROGRAMS\Notepad++\Uninstall.lnk"
RMDir "$SMPROGRAMS\Notepad++"
Delete "$SMPROGRAMS\${APPNAME}\Notepad++.lnk"
Delete "$SMPROGRAMS\${APPNAME}\readme.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
RMDir "$SMPROGRAMS\${APPNAME}"
; detect the right of
UserInfo::GetAccountType
@ -276,8 +277,8 @@ Function shortcutLinkManagement
SetOutPath "$INSTDIR\"
; add all the npp shortcuts for all user or current user
CreateDirectory "$SMPROGRAMS\Notepad++"
CreateShortCut "$SMPROGRAMS\Notepad++\Notepad++.lnk" "$INSTDIR\notepad++.exe"
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\${APPNAME}\Notepad++.lnk" "$INSTDIR\notepad++.exe"
${If} $createShortcutChecked == ${BST_CHECKED}
CreateShortCut "$DESKTOP\Notepad++.lnk" "$INSTDIR\notepad++.exe"
${EndIf}

View File

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

View File

@ -115,17 +115,17 @@ Section Uninstall
Delete "$INSTDIR\uninstall.exe"
; Delete Shortcuts
Delete "$SMPROGRAMS\Notepad++\Uninstall.lnk"
RMDir "$SMPROGRAMS\Notepad++"
Delete "$SMPROGRAMS\${APPNAME}\Uninstall.lnk"
RMDir "$SMPROGRAMS\${APPNAME}"
UserInfo::GetAccountType
Pop $1
StrCmp $1 "Admin" 0 +2
SetShellVarContext all
SetShellVarContext all ; make context for all user
Delete "$DESKTOP\Notepad++.lnk"
Delete "$SMPROGRAMS\Notepad++\Notepad++.lnk"
Delete "$SMPROGRAMS\Notepad++\readme.lnk"
Delete "$SMPROGRAMS\${APPNAME}\Notepad++.lnk"
Delete "$SMPROGRAMS\${APPNAME}\readme.lnk"
; Clean up Notepad++
@ -154,24 +154,29 @@ Section Uninstall
Delete "$INSTDIR\SourceCodePro-Bold.ttf"
Delete "$INSTDIR\SourceCodePro-It.ttf"
Delete "$INSTDIR\SourceCodePro-BoldIt.ttf"
Delete "$INSTDIR\NppHelp.chm"
; make context as current user to uninstall user's APPDATA
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 "$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}"
RMDir "$APPDATA\Notepad++"
StrCmp $1 "Admin" 0 +2
SetShellVarContext all
SetShellVarContext all ; make context for all user
; Remove remaining directories
RMDir /r "$INSTDIR\plugins\disabled\"
@ -180,8 +185,7 @@ Section Uninstall
RMDir "$INSTDIR\themes\"
RMDir "$INSTDIR\localization\"
RMDir "$INSTDIR\"
RMDir "$SMPROGRAMS\Notepad++"
RMDir "$APPDATA\Notepad++"
RMDir "$SMPROGRAMS\${APPNAME}"
SectionEnd