Skip to content

Commit

Permalink
Add new installer argument /allowAppDataPluginsLoading
Browse files Browse the repository at this point in the history
The new installer argument /allowAppDataPluginsLoading add file
allowAppDataPlugins.xml which allows Notepad++ to load plugins
from "%APPDATA%\Notepad++\plugins\"
  • Loading branch information
donho committed Jul 9, 2017
1 parent e7a5c72 commit 19f24d1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
14 changes: 11 additions & 3 deletions PowerEditor/installer/nppSetup.nsi
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion PowerEditor/installer/nsisInclude/mainSectionFuncs.nsh
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions PowerEditor/installer/nsisInclude/tools.nsh
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 19f24d1

Please sign in to comment.