Skip to content

Commit b02e337

Browse files
fix(installer): move NSIS install commands to external files
1 parent 92c7179 commit b02e337

File tree

4 files changed

+73
-50
lines changed

4 files changed

+73
-50
lines changed

src/installer/_installer.cmake

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ if(WIN32)
4141
"${QT_BASEDIR}/plugins/tls/qcertonlybackend${QT_LIB_SUFFIX}.dll"
4242
"${QT_BASEDIR}/plugins/tls/qschannelbackend${QT_LIB_SUFFIX}.dll"
4343
DESTINATION tls)
44+
45+
# NSIS install commands
46+
configure_file(
47+
"${CMAKE_CURRENT_LIST_DIR}/win/InstallCommands.nsh.in"
48+
"${CMAKE_CURRENT_LIST_DIR}/win/generated/InstallCommands.nsh")
49+
50+
# NSIS uninstall commands
51+
configure_file(
52+
"${CMAKE_CURRENT_LIST_DIR}/win/UninstallCommands.nsh.in"
53+
"${CMAKE_CURRENT_LIST_DIR}/win/generated/UninstallCommands.nsh")
4454
elseif(UNIX)
4555
if (DEFINED QT_BASEDIR)
4656
# If this is a custom install, we've copied the Qt libraries to the build directory and done special fixups
@@ -131,47 +141,8 @@ if(WIN32)
131141
set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT_NAME}.exe")
132142
set(CPACK_NSIS_URL_INFO_ABOUT "${CMAKE_PROJECT_HOMEPAGE_URL}")
133143
set(CPACK_NSIS_MANIFEST_DPI_AWARE ON)
134-
set(HELP_QUOTE "\"") # CMake is shit
135-
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
136-
WriteRegStr HKCR '.007' '' '${PROJECT_NAME_PRETTY}'
137-
WriteRegStr HKCR '.bmz' '' '${PROJECT_NAME_PRETTY}'
138-
WriteRegStr HKCR '.bsp' '' '${PROJECT_NAME_PRETTY}'
139-
WriteRegStr HKCR '.fpx' '' '${PROJECT_NAME_PRETTY}'
140-
WriteRegStr HKCR '.gcf' '' '${PROJECT_NAME_PRETTY}'
141-
WriteRegStr HKCR '.gma' '' '${PROJECT_NAME_PRETTY}'
142-
WriteRegStr HKCR '.ol' '' '${PROJECT_NAME_PRETTY}'
143-
WriteRegStr HKCR '.ore' '' '${PROJECT_NAME_PRETTY}'
144-
WriteRegStr HKCR '.pak' '' '${PROJECT_NAME_PRETTY}'
145-
WriteRegStr HKCR '.pck' '' '${PROJECT_NAME_PRETTY}'
146-
WriteRegStr HKCR '.vpk' '' '${PROJECT_NAME_PRETTY}'
147-
WriteRegStr HKCR '.dmx' '' '${PROJECT_NAME_PRETTY}'
148-
WriteRegStr HKCR '.pcf' '' '${PROJECT_NAME_PRETTY}'
149-
WriteRegStr HKCR '.ppl' '' '${PROJECT_NAME_PRETTY}'
150-
WriteRegStr HKCR '.mdl' '' '${PROJECT_NAME_PRETTY}'
151-
WriteRegStr HKCR '${PROJECT_NAME_PRETTY}' '' 'VPKEdit Pack File'
152-
WriteRegStr HKCR '${PROJECT_NAME_PRETTY}\\\\shell' '' 'open'
153-
WriteRegStr HKCR '${PROJECT_NAME_PRETTY}\\\\DefaultIcon' '' '$INSTDIR\\\\${PROJECT_NAME}.exe,0'
154-
WriteRegStr HKCR '${PROJECT_NAME_PRETTY}\\\\shell\\\\open\\\\command' '' '$INSTDIR\\\\${PROJECT_NAME}.exe \\${HELP_QUOTE}%1\\${HELP_QUOTE}'
155-
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
156-
")
157-
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
158-
DeleteRegKey HKCR '.007'
159-
DeleteRegKey HKCR '.bmz'
160-
DeleteRegKey HKCR '.bsp'
161-
DeleteRegKey HKCR '.fpx'
162-
DeleteRegKey HKCR '.gcf'
163-
DeleteRegKey HKCR '.gma'
164-
DeleteRegKey HKCR '.ol'
165-
DeleteRegKey HKCR '.ore'
166-
DeleteRegKey HKCR '.pak'
167-
DeleteRegKey HKCR '.pck'
168-
DeleteRegKey HKCR '.vpk'
169-
DeleteRegKey HKCR '.dmx'
170-
DeleteRegKey HKCR '.pcf'
171-
DeleteRegKey HKCR '.ppl'
172-
DeleteRegKey HKCR '.mdl'
173-
DeleteRegKey HKCR '${PROJECT_NAME_PRETTY}'
174-
")
144+
file(READ "${CMAKE_CURRENT_LIST_DIR}/win/generated/InstallCommands.nsh" CPACK_NSIS_EXTRA_INSTALL_COMMANDS)
145+
file(READ "${CMAKE_CURRENT_LIST_DIR}/win/generated/UninstallCommands.nsh" CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS)
175146
else()
176147
if(NOT (CPACK_GENERATOR STREQUAL "DEB"))
177148
message(WARNING "CPack generator must be DEB! Setting generator to DEB...")

src/installer/linux/mime-type.xml.in

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,6 @@
106106
<glob pattern="*.dmx"/>
107107
<glob pattern="*.DMX"/>
108108
</mime-type>
109-
<mime-type type="application/x-ppl">
110-
<comment>Prop Lightmap</comment>
111-
<icon name="application-x-ppl"/>
112-
<acronym>PPL</acronym>
113-
<expanded-acronym>Prop Lightmap</expanded-acronym>
114-
<glob-deleteall/>
115-
<glob pattern="*.ppl"/>
116-
<glob pattern="*.PPL"/>
117-
</mime-type>
118109
<mime-type type="application/x-mdl">
119110
<comment>Model</comment>
120111
<icon name="application-x-mdl"/>
@@ -124,6 +115,15 @@
124115
<glob pattern="*.mdl"/>
125116
<glob pattern="*.MDL"/>
126117
</mime-type>
118+
<mime-type type="application/x-ppl">
119+
<comment>Prop Lightmap</comment>
120+
<icon name="application-x-ppl"/>
121+
<acronym>PPL</acronym>
122+
<expanded-acronym>Prop Lightmap</expanded-acronym>
123+
<glob-deleteall/>
124+
<glob pattern="*.ppl"/>
125+
<glob pattern="*.PPL"/>
126+
</mime-type>
127127
<mime-type type="image/x-vtf">
128128
<comment>Valve Texture File</comment>
129129
<icon name="image-x-vtf"/>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
WriteRegStr HKCR '.007' '' '${PROJECT_NAME}_pack_file'
2+
WriteRegStr HKCR '.bmz' '' '${PROJECT_NAME}_pack_file'
3+
WriteRegStr HKCR '.bsp' '' '${PROJECT_NAME}_pack_file'
4+
WriteRegStr HKCR '.fpx' '' '${PROJECT_NAME}_pack_file'
5+
WriteRegStr HKCR '.gcf' '' '${PROJECT_NAME}_pack_file'
6+
WriteRegStr HKCR '.gma' '' '${PROJECT_NAME}_pack_file'
7+
WriteRegStr HKCR '.ol' '' '${PROJECT_NAME}_pack_file'
8+
WriteRegStr HKCR '.ore' '' '${PROJECT_NAME}_pack_file'
9+
WriteRegStr HKCR '.pak' '' '${PROJECT_NAME}_pack_file'
10+
WriteRegStr HKCR '.pck' '' '${PROJECT_NAME}_pack_file'
11+
WriteRegStr HKCR '.vpk' '' '${PROJECT_NAME}_pack_file'
12+
13+
WriteRegStr HKCR '${PROJECT_NAME}_pack_file' '' '${PROJECT_NAME_PRETTY} Pack File'
14+
WriteRegStr HKCR '${PROJECT_NAME}_pack_file\\shell' '' 'open'
15+
WriteRegStr HKCR '${PROJECT_NAME}_pack_file\\DefaultIcon' '' '$INSTDIR\\${PROJECT_NAME}.exe,0'
16+
WriteRegStr HKCR '${PROJECT_NAME}_pack_file\\shell\\open\\command' '' '$INSTDIR\\${PROJECT_NAME}.exe \"%1\"'
17+
18+
WriteRegStr HKCR '.dmx' '' '${PROJECT_NAME}_asset'
19+
WriteRegStr HKCR '.mdl' '' '${PROJECT_NAME}_asset'
20+
WriteRegStr HKCR '.pcf' '' '${PROJECT_NAME}_asset'
21+
WriteRegStr HKCR '.ppl' '' '${PROJECT_NAME}_asset'
22+
WriteRegStr HKCR '.vtf' '' '${PROJECT_NAME}_asset'
23+
24+
WriteRegStr HKCR '${PROJECT_NAME}_asset' '' '${PROJECT_NAME_PRETTY} Asset'
25+
WriteRegStr HKCR '${PROJECT_NAME}_asset\\shell' '' 'open'
26+
WriteRegStr HKCR '${PROJECT_NAME}_asset\\DefaultIcon' '' '$INSTDIR\\${PROJECT_NAME}.exe,0'
27+
WriteRegStr HKCR '${PROJECT_NAME}_asset\\shell\\open\\command' '' '$INSTDIR\\${PROJECT_NAME}.exe \"%1\"'
28+
29+
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
DeleteRegKey HKCR '.007'
2+
DeleteRegKey HKCR '.bmz'
3+
DeleteRegKey HKCR '.bsp'
4+
DeleteRegKey HKCR '.fpx'
5+
DeleteRegKey HKCR '.gcf'
6+
DeleteRegKey HKCR '.gma'
7+
DeleteRegKey HKCR '.ol'
8+
DeleteRegKey HKCR '.ore'
9+
DeleteRegKey HKCR '.pak'
10+
DeleteRegKey HKCR '.pck'
11+
DeleteRegKey HKCR '.vpk'
12+
13+
DeleteRegKey HKCR '${PROJECT_NAME}_pack_file'
14+
15+
DeleteRegKey HKCR '.dmx'
16+
DeleteRegKey HKCR '.mdl'
17+
DeleteRegKey HKCR '.pcf'
18+
DeleteRegKey HKCR '.ppl'
19+
DeleteRegKey HKCR '.vtf'
20+
21+
DeleteRegKey HKCR '${PROJECT_NAME}_asset'
22+
23+
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'

0 commit comments

Comments
 (0)