default_template.nsi 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. ;NSIS Modern User Interface version 1.70
  2. ;--------------------------------
  3. ;Include Modern UI
  4. !include "MUI.nsh"
  5. ;--------------------------------
  6. ;General
  7. !define REG_KEY "<RegKey>"
  8. ;Name and file
  9. Name "<Name>"
  10. OutFile "<OutFile>"
  11. ;Default installation folder
  12. InstallDir "<InstallDir>"
  13. InstallDirRegKey HKLM "${REG_KEY}" "Install_Dir"
  14. DirText "This will install the $(^Name) on your computer. Please choose a directory"
  15. BrandingText "<BrandingText>"
  16. ;--------------------------------
  17. ;Interface Settings
  18. !define MUI_ABORTWARNING
  19. !define MUI_ICON "<TemplatePath>\main.ico"
  20. !define MUI_UNICON "<TemplatePath>\main.ico"
  21. !define MUI_COMPONENTSPAGE_SMALLDESC
  22. !define MUI_HEADERIMAGE
  23. !define MUI_WELCOMEFINISHPAGE_BITMAP "<PanelImage>"
  24. !define MUI_HEADERIMAGE_BITMAP "<HeaderImage>"
  25. <FinishLaunch>
  26. ;--------------------------------
  27. ;Pages
  28. !insertmacro MUI_PAGE_WELCOME
  29. !insertmacro MUI_PAGE_COMPONENTS
  30. !insertmacro MUI_PAGE_DIRECTORY
  31. !insertmacro MUI_PAGE_INSTFILES
  32. !insertmacro MUI_UNPAGE_CONFIRM
  33. !insertmacro MUI_UNPAGE_INSTFILES
  34. !insertmacro MUI_PAGE_FINISH
  35. ;--------------------------------
  36. ;Languages
  37. !insertmacro MUI_LANGUAGE "English"
  38. ;--------------------------------
  39. ; Game section
  40. Section "!$(^Name) (required)" SecGame
  41. SectionIn RO
  42. SetOutPath "$INSTDIR"
  43. File "<TorqueDir>\Engine\bin\tools\getD3DXVer\app\getD3DXVer.exe"
  44. File "<TorqueDir>\Engine\bin\tools\dxwebsetup\dxwebsetup.exe"
  45. File /r "<StagingFiles>"
  46. ; Start Menu
  47. SetOutPath "$SMPROGRAMS\$(^Name)"
  48. <StartMenuShortcuts>
  49. SetOutPath "$INSTDIR"
  50. <UninstallShortcuts>
  51. ; Web registry settings
  52. <WebRegistryInstall>
  53. ; Registry uninstall
  54. WriteRegStr HKLM "${REG_KEY}" "" $INSTDIR
  55. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" \
  56. "DisplayName" "$(^Name) (remove only)"
  57. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" \
  58. "UninstallString" '"$INSTDIR\uninst-$(^Name).exe"'
  59. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" \
  60. "DisplayIcon" "$INSTDIR\uninst-$(^Name).exe"
  61. ; Check for DX and D3DX version
  62. ExecWait "$INSTDIR\getD3DXVer.exe"
  63. IfErrors AskDXInstall NoDXInstall
  64. AskDXInstall:
  65. MessageBox MB_YESNO|MB_ICONQUESTION \
  66. "$(^Name) requires a newer version of DirectX than you have installed on your computer. Would you like to launch the Microsoft DirectX web installer?" IDNO NoDXInstall
  67. ; Install DirectX from the web
  68. ExecWait "$INSTDIR\dxwebsetup.exe"
  69. IfErrors NoDXInstall NoDXInstall
  70. NoDXInstall:
  71. ; Do nothing and go onto the next step.
  72. ;Create uninstaller
  73. WriteUninstaller "$INSTDIR\uninst-$(^Name).exe"
  74. SectionEnd
  75. ;--------------------------------
  76. ; Desktop Shortcut
  77. Section "Desktop Shortcut" SecDesktop
  78. ; Desktop
  79. SetOutPath "$INSTDIR"
  80. <DesktopShortcuts>
  81. SectionEnd
  82. ;--------------------------------
  83. ; Readme at the end
  84. <LoadGame>
  85. ;--------------------------------
  86. ; Uninstaller
  87. Section Uninstall
  88. MessageBox MB_YESNO|MB_ICONQUESTION \
  89. "Everything in the $(^Name) directory will be deleted. Are you sure you wish to uninstall the $(^Name)?" \
  90. IDNO Removed
  91. ; Shortcuts
  92. <ShortcutsRemove>
  93. RMDir "$SMPROGRAMS\$(^Name)"
  94. ; Registry
  95. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
  96. DeleteRegKey HKLM "${REG_KEY}"
  97. ; Web registry uninstall settings
  98. <WebRegistryUninstall>
  99. ; SDK Source and Binaries
  100. RMDir /r $INSTDIR
  101. IfFileExists $INSTDIR 0 Removed
  102. MessageBox MB_OK|MB_ICONEXCLAMATION \
  103. "Note: $INSTDIR could not be removed."
  104. Removed:
  105. SectionEnd
  106. ;--------------------------------
  107. ;Descriptions
  108. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  109. !insertmacro MUI_DESCRIPTION_TEXT ${SecGame} "Install $(^Name). This component is required."
  110. !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "Create a shortcut on your desktop"
  111. <loadGameInsert>
  112. !insertmacro MUI_FUNCTION_DESCRIPTION_END