Install default plugins into new location

Install default plugins into %USERPROFILE%\AppData\Local\Notepad++\plugins\ instead of %PROGRAMFILES(x86)%\Notepad++\plugins\
This commit is contained in:
Don HO 2018-11-04 22:21:04 +01:00
parent 113212547f
commit e61fe03d89
3 changed files with 42 additions and 8 deletions

View File

@ -99,8 +99,14 @@ page Custom ExtraOptions
!include "nsisInclude\mainSectionFuncs.nsh"
Section -"setPathAndOptionsSection" setPathAndOptionsSection
Call setPathAndOptions
SectionEnd
!include "nsisInclude\autoCompletion.nsh"
!include "nsisInclude\binariesComponents.nsh"
InstType "Minimalist"
@ -175,8 +181,6 @@ FunctionEnd
Section -"Notepad++" mainSection
Call setPathAndOptions
${If} $diffArchDir2Remove != ""
!insertmacro uninstallRegKey
!insertmacro uninstallDir $diffArchDir2Remove

View File

@ -28,11 +28,15 @@
SectionGroup "Plugins" Plugins
SetOverwrite on
!ifndef ARCH64
${MementoSection} "NppExport" NppExport
Delete "$INSTDIR\plugins\NppExport.dll"
Delete "$INSTDIR\plugins\NppExport\NppExport.dll"
SetOutPath "$INSTDIR\plugins\NppExport"
Delete "$PLUGIN_INST_PATH\NppExport\NppExport.dll"
MessageBox MB_OK "$PLUGIN_INST_PATH\toto"
SetOutPath "$PLUGIN_INST_PATH\NppExport"
File "..\bin\plugins\NppExport\NppExport.dll"
${MementoSectionEnd}
@ -41,7 +45,9 @@ SectionGroup "Plugins" Plugins
${MementoSection} "Mime Tools" MimeTools
Delete "$INSTDIR\plugins\mimeTools.dll"
Delete "$INSTDIR\plugins\mimeTools\mimeTools.dll"
SetOutPath "$INSTDIR\plugins\mimeTools"
Delete "$PLUGIN_INST_PATH\mimeTools\mimeTools.dll"
SetOutPath "$PLUGIN_INST_PATH\mimeTools"
!ifdef ARCH64
File "..\bin64\plugins\mimeTools\mimeTools.dll"
!else
@ -52,7 +58,9 @@ SectionGroup "Plugins" Plugins
${MementoSection} "Converter" Converter
Delete "$INSTDIR\plugins\NppConverter.dll"
Delete "$INSTDIR\plugins\NppConverter\NppConverter.dll"
SetOutPath "$INSTDIR\plugins\NppConverter"
Delete "$PLUGIN_INST_PATH\NppConverter\NppConverter.dll"
SetOutPath "$PLUGIN_INST_PATH\NppConverter"
!ifdef ARCH64
File "..\bin64\plugins\NppConverter\NppConverter.dll"
!else
@ -65,15 +73,18 @@ SectionGroup "Plugins" Plugins
Delete "$INSTDIR\plugins\DSpellCheck.dll"
Delete "$INSTDIR\plugins\DSpellCheck\DSpellCheck.dll"
SetOutPath "$INSTDIR\plugins\DSpellCheck"
Delete "$PLUGIN_INST_PATH\DSpellCheck\DSpellCheck.dll"
SetOutPath "$PLUGIN_INST_PATH\DSpellCheck"
!ifdef ARCH64
File "..\bin64\plugins\DSpellCheck\DSpellCheck.dll"
SetOutPath "$INSTDIR\plugins\Config\Hunspell"
SetOutPath "$PLUGIN_CONF_PATH\Hunspell"
File "..\bin64\plugins\Config\Hunspell\en_US.aff"
File "..\bin64\plugins\Config\Hunspell\en_US.dic"
!else
File "..\bin\plugins\DSpellCheck\DSpellCheck.dll"
SetOutPath "$INSTDIR\plugins\Config\Hunspell"
SetOutPath "$PLUGIN_CONF_PATH\Hunspell"
File "..\bin\plugins\Config\Hunspell\en_US.aff"
File "..\bin\plugins\Config\Hunspell\en_US.dic"
!endif
@ -108,18 +119,24 @@ SectionGroup un.Plugins
Delete "$INSTDIR\plugins\NppExport.dll"
Delete "$INSTDIR\plugins\NppExport\NppExport.dll"
RMDir "$INSTDIR\plugins\NppExport"
Delete "$PLUGIN_INST_PATH\NppExport\NppExport.dll"
RMDir "$PLUGIN_INST_PATH\NppExport"
SectionEnd
Section un.Converter
Delete "$INSTDIR\plugins\NppConverter.dll"
Delete "$INSTDIR\plugins\NppConverter\NppConverter.dll"
RMDir "$INSTDIR\plugins\NppConverter"
Delete "$PLUGIN_INST_PATH\NppConverter\NppConverter.dll"
RMDir "PLUGIN_INST_PATH\NppConverter"
SectionEnd
Section un.MimeTools
Delete "$INSTDIR\plugins\mimeTools.dll"
Delete "$INSTDIR\plugins\mimeTools\mimeTools.dll"
RMDir "$INSTDIR\plugins\mimeTools"
Delete "PLUGIN_INST_PATH\mimeTools\mimeTools.dll"
RMDir "$PLUGIN_INST_PATH\mimeTools"
SectionEnd
Section un.PluginManager
@ -133,9 +150,13 @@ SectionGroup un.Plugins
Delete "$INSTDIR\plugins\DSpellCheck.dll"
Delete "$INSTDIR\plugins\DSpellCheck\DSpellCheck.dll"
Delete "$UPDATE_PATH\plugins\Config\DSpellCheck.ini"
Delete "$PLUGIN_CONF_PATH\DSpellCheck.ini"
Delete "$INSTDIR\plugins\Config\Hunspell\en_US.aff"
Delete "$PLUGIN_CONF_PATH\Hunspell\en_US.aff"
Delete "$INSTDIR\plugins\Config\Hunspell\en_US.dic"
Delete "$PLUGIN_CONF_PATH\Hunspell\en_US.dic"
RMDir /r "$INSTDIR\plugins\Config" ; Remove Config folder recursively only if empty
RMDir /r "$PLUGIN_CONF_PATH\Config" ; Remove Config folder recursively only if empty
RMDir "$INSTDIR\plugins\DSpellCheck"
SectionEnd

View File

@ -26,6 +26,8 @@
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Var UPDATE_PATH
Var PLUGIN_INST_PATH
Var PLUGIN_CONF_PATH
Function setPathAndOptions
${If} $UPDATE_PATH == ""
Goto initUpdatePath
@ -43,9 +45,16 @@ initUpdatePath:
${If} $noUserDataChecked == ${BST_CHECKED}
File "..\bin\doLocalConf.xml"
StrCpy $PLUGIN_INST_PATH "$INSTDIR\plugins"
StrCpy $PLUGIN_CONF_PATH "$INSTDIR\plugins\Config"
MessageBox MB_OK $PLUGIN_INST_PATH
CreateDirectory $PLUGIN_INST_PATH\config
${ELSE}
IfFileExists $INSTDIR\doLocalConf.xml 0 +2
Delete $INSTDIR\doLocalConf.xml
StrCpy $PLUGIN_INST_PATH "$PROFILE\AppData\Local\${APPNAME}\plugins"
StrCpy $PLUGIN_CONF_PATH "$APPDATA\${APPNAME}\plugins\Config"
MessageBox MB_OK $PLUGIN_INST_PATH
StrCpy $UPDATE_PATH "$APPDATA\${APPNAME}"
CreateDirectory $UPDATE_PATH\plugins\config
${EndIf}