-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstaller.nsi
176 lines (144 loc) · 5.81 KB
/
installer.nsi
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
; Windows Installer for easyFG
; Author: Mikhail N Polyanskiy (polyanskiy@bnl.gov)
; Brookhaven National Laboratory, USA
!include "MUI2.nsh"
;General
Name "easyFG"
OutFile "easyFG_20230118.exe"
;Default install path
InstallDir "$PROGRAMFILES64\easyFG" ;default
InstallDirRegKey HKLM "Software\easyFG" "" ;if previous installation exists (overrides default)
;-------------------------Interface Settings---------------------------
!define MUI_ABORTWARNING
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\win.bmp"
!define EASYFG_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\easyFG"
!define EASYFG_ROOT_KEY "Applications\easyfg.exe"
;Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
;Uninstaller pages
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;Languages
!insertmacro MUI_LANGUAGE "English"
;-------------------------Installer Sections---------------------------
Section "Section_01" Sec01
;Read previous installation path from registry
ReadRegDWORD $0 HKLM "Software\easyFG" ""
;Remove previous installation
SetShellVarContext all
RMDir /r $0
RMDir /r "$SMPROGRAMS\easyFG"
RMDir /r "$INSTDIR"
;Write files to installation directory
SetOutPath "$INSTDIR"
;easyFG
File "release\easyfg.exe"
;QT
File "C:\Qt\6.4.2\mingw_64\bin\Qt6Core.dll"
File "C:\Qt\6.4.2\mingw_64\bin\Qt6Gui.dll"
File "C:\Qt\6.4.2\mingw_64\bin\Qt6Widgets.dll"
;MinGW
File "C:\Qt\Tools\mingw1120_64\bin\libgcc_s_seh-1.dll"
File "C:\Qt\Tools\mingw1120_64\bin\libstdc++-6.dll"
File "C:\Qt\Tools\mingw1120_64\bin\libwinpthread-1.dll"
;HDF5
File "C:\Program Files\HDF_Group\HDF5\1.14.0\bin\hdf5.dll"
File "C:\Program Files\HDF_Group\HDF5\1.14.0\bin\hdf5_hl.dll"
SetOutPath "$INSTDIR\platforms"
File "C:\Qt\6.4.2\mingw_64\plugins\platforms\qwindows.dll"
SetOutPath "$INSTDIR\imageformats"
File "C:\Qt\6.4.2\mingw_64\plugins\imageformats\qjpeg.dll"
File "C:\Qt\6.4.2\mingw_64\plugins\imageformats\qtiff.dll"
SetOutPath "$INSTDIR\src"
File "easyfg.h"
File "clipboard.cpp"
File "gui0_mainwindow.cpp"
File "gui1_image.cpp"
File "gui2_scale.cpp"
File "gui3_cursors.cpp"
File "gui4_analysis.cpp"
File "gui5_reference.cpp"
File "gui6_scene.cpp"
File "load.cpp"
File "main.cpp"
File "memory.cpp"
File "save.cpp"
File "session.cpp"
File "shortcuts.cpp"
File "mainwindow.ui"
File "icon.rc"
File "icon.qrc"
File "easyfg.pro"
File "installer.nsi"
SetOutPath "$INSTDIR\src\icon"
File "icon\*.*"
SetOutPath "$INSTDIR\src\icon\valenky"
File "icon\valenky\*.*"
SetOutPath "$INSTDIR\examples"
File "examples\*.*"
;Write Start menu entries
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\easyFG"
CreateShortCut "$SMPROGRAMS\easyFG\easyFG.lnk" "$INSTDIR\easyfg.exe"
CreateShortCut "$SMPROGRAMS\easyFG\Uninstall easyFG.lnk" "$INSTDIR\uninstall.exe" "" ""
;Create desktope shortcut
CreateShortCut "$DESKTOP\easyfg.lnk" "$INSTDIR\easyfg.exe"
;Registry
WriteRegStr HKLM "Software\easyFG" "" $INSTDIR
WriteRegStr HKCR "${EASYFG_ROOT_KEY}\SupportedTypes" ".asc" ""
WriteRegStr HKCR "${EASYFG_ROOT_KEY}\SupportedTypes" ".csv" ""
WriteRegStr HKCR "${EASYFG_ROOT_KEY}\SupportedTypes" ".sif" ""
WriteRegStr HKCR "${EASYFG_ROOT_KEY}\SupportedTypes" ".tif" ""
WriteRegStr HKCR "${EASYFG_ROOT_KEY}\SupportedTypes" ".tiff" ""
WriteRegStr HKCR "${EASYFG_ROOT_KEY}\SupportedTypes" ".raw" ""
WriteRegStr HKCR "${EASYFG_ROOT_KEY}\SupportedTypes" ".bgdata" ""
WriteRegStr HKCR "${EASYFG_ROOT_KEY}\shell\open" "FriendlyAppName" "easyFG"
WriteRegStr HKCR "${EASYFG_ROOT_KEY}\shell\open\command" "" '"$INSTDIR\easyfg.exe" "%1"'
;Register extensions
WriteRegStr HKCR ".asc\OpenWithProgIds" "easyFG" ""
WriteRegStr HKCR ".csv\OpenWithProgIds" "easyFG" ""
WriteRegStr HKCR ".sif\OpenWithProgIds" "easyFG" ""
WriteRegStr HKCR ".tif\OpenWithProgIds" "easyFG" ""
WriteRegStr HKCR ".tiff\OpenWithProgIds" "easyFG" ""
WriteRegStr HKCR ".raw\OpenWithProgIds" "easyFG" ""
WriteRegStr HKCR ".bgdata\OpenWithProgIds" "easyFG" ""
WriteRegStr HKCR "easyFG\shell\open" "FriendlyAppName" "easyFG";
WriteRegStr HKCR "easyFG\shell\open\command" "" '"$INSTDIR\easyfg.exe" "%1"'
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "${EASYFG_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "${EASYFG_UNINST_KEY}" "DisplayName" "easyFG"
WriteRegStr HKLM "${EASYFG_UNINST_KEY}" "DisplayIcon" "$INSTDIR\easyfg.exe"
SectionEnd
;-------------------------Uninstaller Section---------------------------
Section "Uninstall"
SetShellVarContext all
RMDir /r "$SMPROGRAMS\easyFG"
Delete "$DESKTOP\easyfg.lnk"
Delete "$INSTDIR\uninstall.exe"
RMDir /r "$INSTDIR"
;clear registry
DeleteRegKey HKLM "Software\easyFG"
DeleteRegKey HKLM "${EASYFG_UNINST_KEY}"
DeleteRegKey HKCR "${EASYFG_ROOT_KEY}"
DeleteRegKey HKCR "easyFG"
DeleteRegValue HKCR ".asc\OpenWithProgIds" "easyFG"
DeleteRegValue HKCR ".csv\OpenWithProgIds" "easyFG"
DeleteRegValue HKCR ".sif\OpenWithProgIds" "easyFG"
DeleteRegValue HKCR ".tif\OpenWithProgIds" "easyFG"
DeleteRegValue HKCR ".tiff\OpenWithProgIds" "easyFG"
DeleteRegValue HKCR ".raw\OpenWithProgIds" "easyFG"
DeleteRegValue HKCR ".bgdata\OpenWithProgIds" "easyFG"
;remove regestry entries not properly cleared in previous versions
DeleteRegValue HKCR ".asc\OpenWithProgIds" "easyFG.asc"
DeleteRegValue HKCR ".sif\OpenWithProgIds" "easyFG.sif"
DeleteRegValue HKCR ".tif\OpenWithProgIds" "easyFG.tif"
DeleteRegValue HKCR ".tiff\OpenWithProgIds" "easyFG.tiff"
DeleteRegValue HKCR ".raw\OpenWithProgIds" "easyFG.raw"
SectionEnd