Skip to content

Commit 4210875

Browse files
authored
Add files via upload
1 parent ee7df47 commit 4210875

1 file changed

Lines changed: 41 additions & 28 deletions

File tree

nsis/installer.nsi

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ XPStyle on
3232
; vars
3333

3434
Var existing_ini_filename
35-
Var install_options
35+
Var admin_install_options
36+
Var user_install_options
3637

3738
BrandingText "void Image Viewer ${VERSION}${BETAVERSION} (${TARGETMACHINE}) Setup"
3839

@@ -171,138 +172,139 @@ FunctionEnd
171172
Section "voidImageViewer" SECTION_VOIDIMAGEVIEWER
172173

173174
; init
174-
StrCpy $install_options ""
175+
StrCpy $admin_install_options ""
176+
StrCpy $user_install_options ""
175177

176178
; app data
177179
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions.ini" "Field 2" "State"
178180
strcmp $R0 "0" no_app_data
179-
StrCpy $install_options "$install_options /appdata"
181+
StrCpy $admin_install_options "$admin_install_options /appdata"
180182
Goto skip_app_data
181183

182184
no_app_data:
183185

184186
; this option is special, we MUST unset any option that voidImageViewer was previously installed with.
185-
StrCpy $install_options "$install_options /noappdata"
187+
StrCpy $admin_install_options "$admin_install_options /noappdata"
186188

187189
skip_app_data:
188190

189191
; startmenu
190192
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 1" "State"
191193
strcmp $R0 "0" no_startmenu
192-
StrCpy $install_options "$install_options /startmenu"
194+
StrCpy $admin_install_options "$admin_install_options /startmenu"
193195
Goto skip_startmenu
194196

195197
no_startmenu:
196198

197-
StrCpy $install_options "$install_options /nostartmenu"
199+
StrCpy $admin_install_options "$admin_install_options /nostartmenu"
198200

199201
skip_startmenu:
200202

201203
; BMP Associations
202204
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 3" "State"
203205
strcmp $R0 "0" no_bmp_association
204-
StrCpy $install_options "$install_options /bmp"
206+
StrCpy $user_install_options "$user_install_options /bmp"
205207
Goto skip_bmp_association
206208

207209
no_bmp_association:
208210

209-
StrCpy $install_options "$install_options /nobmp"
211+
StrCpy $user_install_options "$user_install_options /nobmp"
210212

211213
skip_bmp_association:
212214

213215
; GIF Associations
214216
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 4" "State"
215217
strcmp $R0 "0" no_gif_association
216-
StrCpy $install_options "$install_options /gif"
218+
StrCpy $user_install_options "$user_install_options /gif"
217219
Goto skip_gif_association
218220

219221
no_gif_association:
220222

221-
StrCpy $install_options "$install_options /nogif"
223+
StrCpy $user_install_options "$user_install_options /nogif"
222224

223225
skip_gif_association:
224226

225227
; ico Associations
226228
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 5" "State"
227229
strcmp $R0 "0" no_ico_association
228-
StrCpy $install_options "$install_options /ico"
230+
StrCpy $user_install_options "$user_install_options /ico"
229231
Goto skip_ico_association
230232

231233
no_ico_association:
232234

233-
StrCpy $install_options "$install_options /noico"
235+
StrCpy $user_install_options "$user_install_options /noico"
234236

235237
skip_ico_association:
236238

237239
; jpeg Associations
238240
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 6" "State"
239241
strcmp $R0 "0" no_jpeg_association
240-
StrCpy $install_options "$install_options /jpeg"
242+
StrCpy $user_install_options "$user_install_options /jpeg"
241243
Goto skip_jpeg_association
242244

243245
no_jpeg_association:
244246

245-
StrCpy $install_options "$install_options /nojpeg"
247+
StrCpy $user_install_options "$user_install_options /nojpeg"
246248

247249
skip_jpeg_association:
248250

249251
; jpg Associations
250252
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 7" "State"
251253
strcmp $R0 "0" no_jpg_association
252-
StrCpy $install_options "$install_options /jpg"
254+
StrCpy $user_install_options "$user_install_options /jpg"
253255
Goto skip_jpg_association
254256

255257
no_jpg_association:
256258

257-
StrCpy $install_options "$install_options /nojpg"
259+
StrCpy $user_install_options "$user_install_options /nojpg"
258260

259261
skip_jpg_association:
260262

261263
; png Associations
262264
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 8" "State"
263265
strcmp $R0 "0" no_png_association
264-
StrCpy $install_options "$install_options /png"
266+
StrCpy $user_install_options "$user_install_options /png"
265267
Goto skip_png_association
266268

267269
no_png_association:
268270

269-
StrCpy $install_options "$install_options /nopng"
271+
StrCpy $user_install_options "$user_install_options /nopng"
270272

271273
skip_png_association:
272274

273275
; tif Associations
274276
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 9" "State"
275277
strcmp $R0 "0" no_tif_association
276-
StrCpy $install_options "$install_options /tif"
278+
StrCpy $user_install_options "$user_install_options /tif"
277279
Goto skip_tif_association
278280

279281
no_tif_association:
280282

281-
StrCpy $install_options "$install_options /notif"
283+
StrCpy $user_install_options "$user_install_options /notif"
282284

283285
skip_tif_association:
284286

285287
; tiff Associations
286288
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 10" "State"
287289
strcmp $R0 "0" no_tiff_association
288-
StrCpy $install_options "$install_options /tiff"
290+
StrCpy $user_install_options "$user_install_options /tiff"
289291
Goto skip_tiff_association
290292

291293
no_tiff_association:
292294

293-
StrCpy $install_options "$install_options /notiff"
295+
StrCpy $user_install_options "$user_install_options /notiff"
294296

295297
skip_tiff_association:
296298

297299
; webp Associations
298-
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 10" "State"
300+
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "InstallOptions2.ini" "Field 11" "State"
299301
strcmp $R0 "0" no_webp_association
300-
StrCpy $install_options "$install_options /webp"
302+
StrCpy $user_install_options "$user_install_options /webp"
301303
Goto skip_webp_association
302304

303305
no_webp_association:
304306

305-
StrCpy $install_options "$install_options /nowebp"
307+
StrCpy $user_install_options "$user_install_options /nowebp"
306308

307309
skip_webp_association:
308310

@@ -333,12 +335,12 @@ skip_webp_association:
333335
; check for command line options that will override the default install options.
334336
${GetOptions} $CMDLINE "/install-options" $0
335337
IfErrors +2
336-
StrCpy $install_options "$install_options $0"
338+
StrCpy $admin_install_options "$admin_install_options $0"
337339

338340
; install with admin rights.
339-
; MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "ADMIN $install_options"
341+
; MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION "ADMIN $admin_install_options"
340342
ClearErrors
341-
ExecWait '"$pluginsdir\voidImageViewer\voidImageViewer.exe" /install "$INSTDIR" /install-options "$install_options"' $0
343+
ExecWait '"$pluginsdir\voidImageViewer\voidImageViewer.exe" /install "$INSTDIR" /install-options "$admin_install_options"' $0
342344
IfErrors exec_admin_error
343345
IntCmp $0 0 exec_admin_ok
344346

@@ -348,6 +350,17 @@ exec_admin_error:
348350

349351
exec_admin_ok:
350352

353+
ClearErrors
354+
ExecWait '"$INSTDIR\voidImageViewer.exe" $user_install_options' $0
355+
IfErrors exec_install_options_error
356+
IntCmp $0 0 exec_install_options_ok
357+
358+
exec_install_options_error:
359+
360+
MessageBox MB_OK|MB_ICONSTOP "Failed to execute install options"
361+
362+
exec_install_options_ok:
363+
351364
SectionEnd
352365

353366
Section "Uninstall"

0 commit comments

Comments
 (0)