control_utils.nsh (1083B)
1 # This Source Code Form is subject to the terms of the Mozilla Public 2 # License, v. 2.0. If a copy of the MPL was not distributed with this 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 ; This is needed because NSIS's SetShellVarContext doesn't allow 6 ; you to specify shell var context as a variable. C'est la vie. 7 !macro SetShellVarContextToValue CTX_VALUE 8 ${If} ${CTX_VALUE} == "all" 9 SetShellVarContext all 10 ${ElseIf} ${CTX_VALUE} == "current" 11 SetShellVarContext current 12 ${Else} 13 SetErrors 14 ${EndIf} 15 !macroend 16 !define SetShellVarContextToValue "!insertmacro SetShellVarContextToValue" 17 18 19 ; Switch to a different shell var context, returning the previous shell 20 ; var context. 21 ; Params: 22 ; IN: the shell var context to switch to 23 ; OUT: the previous shell var context 24 !macro SwapShellVarContext IN OUT 25 ${If} ${ShellVarContextAll} 26 StrCpy ${OUT} "all" 27 ${Else} 28 StrCpy ${OUT} "current" 29 ${EndIf} 30 31 ${SetShellVarContextToValue} ${IN} 32 !macroend 33 !define SwapShellVarContext "!insertmacro SwapShellVarContext"