diff --git a/PowerEditor/installer/nppSetup.nsi b/PowerEditor/installer/nppSetup.nsi index 4c2dda03..264f0b9f 100644 --- a/PowerEditor/installer/nppSetup.nsi +++ b/PowerEditor/installer/nppSetup.nsi @@ -113,7 +113,7 @@ Function .onInit ; check if 32-bit version has been installed if yes, ask user to remove it IfFileExists $PROGRAMFILES\${APPNAME}\notepad++.exe 0 noDelete32 - MessageBox MB_YESNO "You're installing 64-bit version. 32-bit version has been installed. Remove it?$\n(Your custom config files will be kept)" /SD IDYES IDYES doDelete32 IDNO noDelete32 ;IDYES remove + MessageBox MB_YESNO "You are trying to install 64-bit version while 32-bit version is already installed. Would you like to remove Notepad++ 32 bit version before proceeding further?$\n(Your custom config files will be kept)" /SD IDYES IDYES doDelete32 IDNO noDelete32 ;IDYES remove doDelete32: StrCpy $diffArchDir2Remove $PROGRAMFILES\${APPNAME} noDelete32: @@ -126,7 +126,7 @@ noDelete32: ${If} ${RunningX64} ; check if 64-bit version has been installed if yes, ask user to remove it IfFileExists $PROGRAMFILES64\${APPNAME}\notepad++.exe 0 noDelete64 - MessageBox MB_YESNO "You're installing 32-bit version. 64-bit version has been installed. Remove it?$\n(Your custom config files will be kept)" /SD IDYES IDYES doDelete64 IDNO noDelete64 + MessageBox MB_YESNO "You are trying to install 32-bit version while 64-bit version is already installed. Would you like to remove Notepad++ 64 bit version before proceeding further?$\n(Your custom config files will be kept)" /SD IDYES IDYES doDelete64 IDNO noDelete64 doDelete64: StrCpy $diffArchDir2Remove $PROGRAMFILES64\${APPNAME} noDelete64: diff --git a/PowerEditor/installer/nsisInclude/uninstall.nsh b/PowerEditor/installer/nsisInclude/uninstall.nsh index 314e8b04..4ba6809c 100644 --- a/PowerEditor/installer/nsisInclude/uninstall.nsh +++ b/PowerEditor/installer/nsisInclude/uninstall.nsh @@ -27,8 +27,10 @@ Var themesParentPath Var doLocalConf +Var keepUserData Function un.onInit - ; determinate theme path for uninstall themes + StrCpy $keepUserData "false" ; default value(It is must, otherwise few files such as shortcuts.xml, contextMenu.xml etc, will not be removed when $INSTDIR\doLocalConf.xml is not avaliable.) + ; determinate theme path for uninstall themes StrCpy $themesParentPath "$APPDATA\${APPNAME}" StrCpy $doLocalConf "false" IfFileExists $INSTDIR\doLocalConf.xml doesExist noneExist @@ -39,6 +41,21 @@ noneExist: ;MessageBox MB_OK "doLocalConf == $doLocalConf" FunctionEnd +Function un.onUninstSuccess + ; make sure all the empty folders are deleted on successful uninstall + ; These folders will be deleted only if they are emtpy + RMDir "$INSTDIR\localization\" + RMDir "$INSTDIR\plugins\APIs\" + RMDir "$INSTDIR\plugins\disabled\" + RMDir "$INSTDIR\plugins\" + RMDir "$INSTDIR\updater\" + RMDir "$INSTDIR\" + + RMDir "$APPDATA\${APPNAME}\plugins\" + RMDir "$themesParentPath\themes\" ; if files are kept because of $keepUserData, this will not be deleted + RMDir "$themesParentPath\" +FunctionEnd + Section un.explorerContextMenu Exec 'regsvr32 /u /s "$INSTDIR\NppShell_01.dll"' @@ -116,7 +133,6 @@ Section un.UserManual SectionEnd -Var keepUserData Function un.doYouReallyWantToKeepData StrCpy $keepUserData "false" MessageBox MB_YESNO "Would you like to keep your custom settings?" /SD IDNO IDYES skipRemoveUserData IDNO removeUserData @@ -247,9 +263,9 @@ Section Uninstall Delete "$APPDATA\${APPNAME}\insertExt.ini" RMDir /r "$APPDATA\${APPNAME}\plugins\" - RMDir "$APPDATA\${APPNAME}\backup\" - RMDir "$APPDATA\${APPNAME}\themes\" - RMDir "$APPDATA\${APPNAME}" + RMDir /r "$APPDATA\${APPNAME}\backup\" ; Remove backup folder recursively if not empty + RMDir "$APPDATA\${APPNAME}\themes\" ; has no effect as not empty at this momenet, but it is taken care at un.onUninstSuccess + RMDir "$APPDATA\${APPNAME}" ; has no effect as not empty at this momenet, but it is taken care at un.onUninstSuccess StrCmp $1 "Admin" 0 +2 SetShellVarContext all ; make context for all user