Add new installer argument /allowAppDataPluginsLoading

The new installer argument /allowAppDataPluginsLoading add file
allowAppDataPlugins.xml which allows Notepad++ to load plugins
from "%APPDATA%\Notepad++\plugins\"
This commit is contained in:
Don HO 2017-07-09 08:58:44 +02:00
parent e7a5c72465
commit 19f24d1d65
3 changed files with 21 additions and 4 deletions

View File

@ -37,6 +37,7 @@ Unicode true ; Generate a Unicode installer. It can only be used outside of se
SetCompressor /SOLID lzma ; This reduces installer size by approx 30~35%
;SetCompressor /FINAL lzma ; This reduces installer size by approx 15~18%
Var allowAppDataPluginsLoading
!include "nsisInclude\winVer.nsh"
!include "nsisInclude\globalDef.nsh"
@ -82,15 +83,22 @@ page Custom ExtraOptions
!define MUI_PAGE_CUSTOMFUNCTION_SHOW "un.CheckIfRunning"
!insertmacro MUI_UNPAGE_INSTFILES
; TODO for optional arg
;!insertmacro GetParameters
!include "nsisInclude\langs4Installer.nsh"
Var diffArchDir2Remove
Function .onInit
${GetParameters} $R0
${GetOptions} $R0 "/allowAppDataPluginsLoading" $R1 ;case insensitive
IfErrors appdataLoadNo appdataLoadYes
appdataLoadNo:
StrCpy $allowAppDataPluginsLoading "false"
Goto appdataLoadDone
appdataLoadYes:
StrCpy $allowAppDataPluginsLoading "true"
appdataLoadDone:
SectionSetSize ${mainSection} 4500 ; This is rough estimation of files present in function copyCommonFiles
InitPluginsDir ; Initializes the plug-ins dir ($PLUGINSDIR) if not already initialized.
Call preventInstallInWin9x

View File

@ -42,7 +42,7 @@ Function setPathAndOptions
CreateDirectory $UPDATE_PATH\plugins\config
${EndIf}
${If} $allowPluginLoadFromUserDataChecked == ${BST_CHECKED}
${If} $allowAppDataPluginsLoading == "true"
File "..\bin\allowAppDataPlugins.xml"
${ELSE}
IfFileExists $INSTDIR\allowAppDataPlugins.xml 0 +2

View File

@ -100,6 +100,9 @@ Function ExtraOptions
${NSD_CreateCheckbox} 0 50 100% 30u "Allow plugins to be loaded from %APPDATA%\notepad++\plugins$\nIt could cause a security issue. Turn it on if you know what you are doing."
Pop $PluginLoadFromUserDataCheckboxHandle
${NSD_OnClick} $PluginLoadFromUserDataCheckboxHandle OnChange_PluginLoadFromUserDataCheckBox
${If} $allowAppDataPluginsLoading == "true"
${NSD_Check} $PluginLoadFromUserDataCheckboxHandle
${EndIf}
${NSD_CreateCheckbox} 0 110 100% 30u "Create Shortcut on Desktop"
Pop $ShortcutCheckboxHandle
@ -138,6 +141,12 @@ FunctionEnd
Function OnChange_PluginLoadFromUserDataCheckBox
${NSD_GetState} $PluginLoadFromUserDataCheckboxHandle $allowPluginLoadFromUserDataChecked
${If} $allowPluginLoadFromUserDataChecked == ${BST_CHECKED}
StrCpy $allowAppDataPluginsLoading "true"
${ELSE}
StrCpy $allowAppDataPluginsLoading "false"
${EndIf}
FunctionEnd
Function OnChange_ShortcutCheckBox