Skip to content

Commit a2a20c6

Browse files
committed
add "install for all users" features. Preserve configuration file on upgrade
1 parent f7defcb commit a2a20c6

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

nsis/desktopbraillerap.nsi

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
!include "MUI2.nsh"
2-
3-
4-
5-
6-
71
; DesktopBrailleRAP.nsi
82
;
93
; This script is based on example1.nsi, but it remember the directory,
104
; has uninstall support and (optionally) installs start menu shortcuts.
115
;
12-
; It will install example2.nsi into a directory that the user selects.
6+
; This script will install DesktopBrailleRAP software and necessary drivers
7+
; to control UART for BrailleRAP communication.
138
;
14-
; See install-shared.nsi for a more robust way of checking for administrator rights.
15-
; See install-per-user.nsi for a file association example.
9+
; This file is licensed under GPL V3 as DesktopBrailleRAP software
10+
; .
1611

1712
;--------------------------------
13+
!include "LogicLib.nsh"
14+
15+
!include "MUI2.nsh"
1816

1917
; The name of the installer
2018
Name "DesktopBrailleRAP"
@@ -47,11 +45,22 @@ InstallDirRegKey HKLM "Software\DesktopBrailleRAP" "Install_Dir"
4745
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp" ; optional
4846
;!define MUI_ABORTWARNING
4947

48+
!define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
49+
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${UNINSTKEY}"
50+
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "CurrentUser"
51+
!define MULTIUSER_INSTALLMODE_INSTDIR "$(^Name)"
52+
!define MULTIUSER_INSTALLMODE_COMMANDLINE
53+
!define MULTIUSER_EXECUTIONLEVEL Admin
54+
!define MULTIUSER_MUI
55+
56+
!include "MultiUser.nsh"
57+
5058

5159
; Pages
5260
!insertmacro MUI_PAGE_WELCOME
5361
;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
5462
;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
63+
!insertmacro MULTIUSER_PAGE_INSTALLMODE
5564
!insertmacro MUI_PAGE_COMPONENTS
5665
!insertmacro MUI_PAGE_DIRECTORY
5766
!insertmacro MUI_PAGE_INSTFILES
@@ -61,6 +70,14 @@ InstallDirRegKey HKLM "Software\DesktopBrailleRAP" "Install_Dir"
6170

6271
!insertmacro MUI_LANGUAGE "English"
6372
!addplugindir ".\"
73+
Function .onInit
74+
!insertmacro MULTIUSER_INIT
75+
FunctionEnd
76+
77+
Function un.onInit
78+
!insertmacro MULTIUSER_UNINIT
79+
FunctionEnd
80+
6481

6582
;--------------------------------
6683

@@ -74,7 +91,9 @@ Section "DesktopBrailleRAP (required)"
7491

7592
; Put file there
7693
File "DesktopBrailleRAP.exe"
94+
SetOverwrite off
7795
File "desktop_brap_parameters.json"
96+
SetOverwrite on
7897
File "_internal.zip"
7998

8099

0 commit comments

Comments
 (0)