/usr/share/nsis/Include/InstallOptions.nsh is in nsis-common 2.46-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | /*
InstallOptions.nsh
Macros and conversion functions for InstallOptions
*/
!ifndef ___NSIS__INSTALL_OPTIONS__NSH___
!define ___NSIS__INSTALL_OPTIONS__NSH___
!include LogicLib.nsh
!macro INSTALLOPTIONS_FUNCTION_READ_CONVERT
!insertmacro INSTALLOPTIONS_FUNCTION_IO2NSIS ""
!macroend
!macro INSTALLOPTIONS_UNFUNCTION_READ_CONVERT
!insertmacro INSTALLOPTIONS_FUNCTION_IO2NSIS un.
!macroend
!macro INSTALLOPTIONS_FUNCTION_WRITE_CONVERT
!insertmacro INSTALLOPTIONS_FUNCTION_NSIS2IO ""
!macroend
!macro INSTALLOPTIONS_UNFUNCTION_WRITE_CONVERT
!insertmacro INSTALLOPTIONS_FUNCTION_NSIS2IO un.
!macroend
!macro INSTALLOPTIONS_FUNCTION_NSIS2IO UNINSTALLER_FUNCPREFIX
; Convert an NSIS string to a form suitable for use by InstallOptions
; Usage:
; Push <NSIS-string>
; Call Nsis2Io
; Pop <IO-string>
Function ${UNINSTALLER_FUNCPREFIX}Nsis2Io
Exch $0 ; The source
Push $1 ; The output
Push $2 ; Temporary char
Push $3 ; Length
Push $4 ; Loop index
StrCpy $1 "" ; Initialise the output
StrLen $3 $0
IntOp $3 $3 - 1
${For} $4 0 $3
StrCpy $2 $0 1 $4
${If} $2 == '\'
StrCpy $2 '\\'
${ElseIf} $2 == '$\r'
StrCpy $2 '\r'
${ElseIf} $2 == '$\n'
StrCpy $2 '\n'
${ElseIf} $2 == '$\t'
StrCpy $2 '\t'
${EndIf}
StrCpy $1 $1$2
${Next}
StrCpy $0 $1
Pop $4
Pop $3
Pop $2
Pop $1
Exch $0
FunctionEnd
!macroend
!macro INSTALLOPTIONS_FUNCTION_IO2NSIS UNINSTALLER_FUNCPREFIX
; Convert an InstallOptions string to a form suitable for use by NSIS
; Usage:
; Push <IO-string>
; Call Io2Nsis
; Pop <NSIS-string>
Function ${UNINSTALLER_FUNCPREFIX}Io2Nsis
Exch $0 ; The source
Push $1 ; The output
Push $2 ; Temporary char
Push $3 ; Length
Push $4 ; Loop index
StrCpy $1 "" ; Initialise the output
StrLen $3 $0
IntOp $3 $3 - 1
${For} $4 0 $3
StrCpy $2 $0 2 $4
${If} $2 == '\\'
StrCpy $2 '\'
IntOp $4 $4 + 1
${ElseIf} $2 == '\r'
StrCpy $2 '$\r'
IntOp $4 $4 + 1
${ElseIf} $2 == '\n'
StrCpy $2 '$\n'
IntOp $4 $4 + 1
${ElseIf} $2 == '\t'
StrCpy $2 '$\t'
IntOp $4 $4 + 1
${EndIf}
StrCpy $2 $2 1
StrCpy $1 $1$2
${Next}
StrCpy $0 $1
Pop $4
Pop $3
Pop $2
Pop $1
Exch $0
FunctionEnd
!macroend
!macro INSTALLOPTIONS_EXTRACT FILE
InitPluginsDir
File "/oname=$PLUGINSDIR\${FILE}" "${FILE}"
!insertmacro INSTALLOPTIONS_WRITE "${FILE}" "Settings" "RTL" "$(^RTL)"
!verbose pop
!macroend
!macro INSTALLOPTIONS_EXTRACT_AS FILE FILENAME
InitPluginsDir
File "/oname=$PLUGINSDIR\${FILENAME}" "${FILE}"
!insertmacro INSTALLOPTIONS_WRITE "${FILENAME}" "Settings" "RTL" "$(^RTL)"
!macroend
!macro INSTALLOPTIONS_DISPLAY FILE
Push $0
InstallOptions::dialog "$PLUGINSDIR\${FILE}"
Pop $0
Pop $0
!macroend
!macro INSTALLOPTIONS_DISPLAY_RETURN FILE
InstallOptions::dialog "$PLUGINSDIR\${FILE}"
!macroend
!macro INSTALLOPTIONS_INITDIALOG FILE
InstallOptions::initDialog "$PLUGINSDIR\${FILE}"
!macroend
!macro INSTALLOPTIONS_SHOW
Push $0
InstallOptions::show
Pop $0
Pop $0
!macroend
!macro INSTALLOPTIONS_SHOW_RETURN
InstallOptions::show
!macroend
!macro INSTALLOPTIONS_READ VAR FILE SECTION KEY
ReadIniStr ${VAR} "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}"
!macroend
!macro INSTALLOPTIONS_WRITE FILE SECTION KEY VALUE
WriteIniStr "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}" "${VALUE}"
!macroend
!macro INSTALLOPTIONS_READ_CONVERT VAR FILE SECTION KEY
ReadIniStr ${VAR} "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}"
Push ${VAR}
Call Io2Nsis
Pop ${VAR}
!macroend
!macro INSTALLOPTIONS_READ_UNCONVERT VAR FILE SECTION KEY
ReadIniStr ${VAR} "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}"
Push ${VAR}
Call un.Io2Nsis
Pop ${VAR}
!macroend
!macro INSTALLOPTIONS_WRITE_CONVERT FILE SECTION KEY VALUE
Push $0
StrCpy $0 "${VALUE}"
Push $0
Call Nsis2Io
Pop $0
WriteIniStr "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}" $0
Pop $0
!macroend
!macro INSTALLOPTIONS_WRITE_UNCONVERT FILE SECTION KEY VALUE
Push $0
StrCpy $0 "${VALUE}"
Push $0
Call un.Nsis2Io
Pop $0
WriteIniStr "$PLUGINSDIR\${FILE}" "${SECTION}" "${KEY}" $0
Pop $0
!macroend
!endif # ___NSIS__INSTALL_OPTIONS__NSH___
|