In game ranking ordered by skill
[scorched3d/parasti.git] / scorched.nsi
blob21ffb6d05525e0c7aad1906618a19b04f3f4ff5d
1 ; Helper defines
2 !define PRODUCT_NAME "Scorched3D"
3 !define PRODUCT_VERSION "42"
4 !define PRODUCT_PUBLISHER "Scorched"
5 !define PRODUCT_WEB_SITE "http://www.scorched3d.co.uk"
6 !define PRODUCT_DONATE_WEB_SITE "https://www.paypal.com/xclick/business=donations%40scorched3d.co.uk&item_name=Scorched3D&no_note=1&tax=0&currency_code=GBP"
7 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
8 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
10 SetCompressor lzma
12 ; MUI 1.67 compatible ------
13 !include "MUI.nsh"
15 ; MUI Settings
16 !define MUI_ABORTWARNING
17 !define MUI_ICON "data\windows\tank2.ico"
18 !define MUI_UNICON "data\windows\tank2.ico"
20 ; Welcome page
21 !insertmacro MUI_PAGE_WELCOME
22 ; License page
23 !insertmacro MUI_PAGE_LICENSE "COPYING"
24 ; Directory page
25 !insertmacro MUI_PAGE_DIRECTORY
26 ; Instfiles page
27 !insertmacro MUI_PAGE_INSTFILES
28 ; Finish page
29 !insertmacro MUI_PAGE_FINISH
31 ; Uninstaller pages
32 !insertmacro MUI_UNPAGE_INSTFILES
34 ; Language files
35 !insertmacro MUI_LANGUAGE "English"
37 ; Reserve files
38 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
40 ; MUI end ------
42 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
43 OutFile "Scorched3D-${PRODUCT_VERSION}.exe"
44 InstallDir "$PROGRAMFILES\Scorched3D"
45 ShowInstDetails show
46 ShowUnInstDetails show
48 Function .onInit
49 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
50 StrCmp $R0 "" done
52 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(^Name) is already installed, do you wish to re-install?" IDOK done
53 Abort
54 done:
55 FunctionEnd
57 Section "MainSection" SEC01
58 SetOutPath "$INSTDIR"
59 SetOverwrite try
61 RMDir /r "$INSTDIR\data"
63 File /r /x ".svn" /x "*.db" "data"
64 File /r /x ".svn" /x "*.db" "documentation"
65 File "*.dll"
66 File "*.manifest"
67 File "AUTHORS"
68 File "COPYING"
69 File "README"
70 File "TODO"
71 File "src\scorched\Release\scorched.exe"
72 File "src\scorched\Release\scorchedc.exe"
73 File "src\scorched\Release\scorcheds.exe"
74 SectionEnd
76 Section -AdditionalIcons
77 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
78 WriteIniStr "$INSTDIR\${PRODUCT_NAME}-docs.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}\wiki"
79 WriteIniStr "$INSTDIR\${PRODUCT_NAME}-donate.url" "InternetShortcut" "URL" "${PRODUCT_DONATE_WEB_SITE}"
81 CreateDirectory "$SMPROGRAMS\Scorched3D"
83 CreateShortCut "$SMPROGRAMS\Scorched3D\Uninstall Scorched3D.lnk" "$INSTDIR\uninst.exe"
84 CreateShortCut "$SMPROGRAMS\Scorched3D\Scorched3D.lnk" "$INSTDIR\scorched.exe" "" "$INSTDIR\data\windows\tank2.ico"
85 CreateShortCut "$SMPROGRAMS\Scorched3D\Scorched3D Documentation.lnk" "$INSTDIR\${PRODUCT_NAME}-docs.url"
86 CreateShortCut "$SMPROGRAMS\Scorched3D\Scorched3D Homepage.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
87 CreateShortCut "$SMPROGRAMS\Scorched3D\Scorched3D Donations.lnk" "$INSTDIR\${PRODUCT_NAME}-donate.url"
88 SectionEnd
90 Section -Post
91 WriteUninstaller "$INSTDIR\uninst.exe"
92 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
93 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
94 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
95 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
96 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
97 SectionEnd
99 Function un.onUninstSuccess
100 HideWindow
101 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
102 FunctionEnd
104 Var DEL_USER
105 Function un.onInit
106 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES remove
107 Abort
108 remove:
110 StrCpy $DEL_USER "FALSE"
111 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to remove all $(^Name) user data. Warning: this includes STATS, saved games, mods etc?" IDNO nodel
112 StrCpy $DEL_USER "TRUE";
113 nodel:
114 FunctionEnd
116 Section Uninstall
118 RMDir /r "$INSTDIR\data"
119 RMDir /r "$INSTDIR\documentation"
120 RMDir /r "$SMPROGRAMS\Scorched3D"
122 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
123 SetAutoClose true
125 StrCmp $DEL_USER "FALSE" nodel
126 RMDir /r "$INSTDIR\.scorched3d"
127 RMDir /r "$PROFILE\.scorched3d"
128 nodel:
130 Delete "$INSTDIR\*.*"
131 RMDir "$INSTDIR"
133 SectionEnd