-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcsmapfx.nsi
120 lines (88 loc) · 3.35 KB
/
csmapfx.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
; csmapfx.nsi
;--------------------------------
; The name of the installer
Name "CsMapFX"
; The file to write
!ifdef MUI_VERSION
!define MAIN_SECTION "CsMapFX ${MUI_VERSION}"
OutFile "..\csmapinst-${MUI_VERSION}.exe"
VIProductVersion ${MUI_VERSION}.0
VIAddVersionKey /LANG=0 "CompanyName" "Eressea"
VIAddVersionKey /LANG=0 "ProductName" "Coast and Sea Mapper"
VIAddVersionKey /LANG=0 "FileDescription" "CsMapFX Application"
VIAddVersionKey /LANG=0 "FileVersion" ${MUI_VERSION}
VIAddVersionKey /LANG=0 "LegalCopyright" "Enno Rehling"
!else
!define MAIN_SECTION "CsMapFX"
OutFile "..\csmapinst.exe"
!endif
; Request application privileges for Windows Vista and higher
RequestExecutionLevel admin
; Build Unicode installer
Unicode True
; The default installation directory
InstallDir $PROGRAMFILES\Eressea\CsMapFX
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\CsMapFX" "Install_Dir"
;--------------------------------
; Pages
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
; The stuff to install
Section "${MAIN_SECTION} (required)"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
; Put files there
File Release\CsMapFX.exe
; File Release\*.dll
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\CsMapFX "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CsMapFX" "DisplayName" "CsMapFX"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CsMapFX" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CsMapFX" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CsMapFX" "NoRepair" 1
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
Section "Additional Game Information"
; Set output path to the installation directory.
SetOutPath $LOCALAPPDATA\Eressea\CsMapFX
; Put file there
File csmapfx.Eressea.info
SectionEnd
; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\CsMapFX"
CreateShortcut "$SMPROGRAMS\CsMapFX\Uninstall.lnk" "$INSTDIR\uninstall.exe"
CreateShortcut "$SMPROGRAMS\CsMapFX\CsMapFX.lnk" "$INSTDIR\CsMapFX.exe"
SectionEnd
Section "Register File Types"
WriteRegStr HKCU 'Software\Classes\.cr\OpenWithProgIDs' 'Eressea.Tools.CsMapFX' ''
WriteRegStr HKCU 'Software\Classes\.cr\DefaultIcon' '' '$INSTDIR\CsMapFX.exe'
WriteRegStr HKCU 'Software\Classes\Eressea.Tools.CsMapFX\shell\open\command' '' '"$INSTDIR\CsMapFX.exe" "%1"'
SectionEnd
;--------------------------------
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CsMapFX"
DeleteRegKey HKLM SOFTWARE\CsMapFX
DeleteRegKey HKCU 'Software\Classes\.cr'
DeleteRegKey HKCU 'Software\Classes\Eressea.Tools.CsMapFX'
; Remove files and uninstaller
Delete $INSTDIR\CsMapFX.exe
Delete $INSTDIR\*.dll
Delete $INSTDIR\*.info
Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\CsMapFX\*.lnk"
; Remove directories
RMDir "$SMPROGRAMS\CsMapFX"
RMDir "$INSTDIR"
SectionEnd