AtomicEditor.nsi 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ;--------------------------------
  2. ;Atomic Editor NSIS Installation Script
  3. ;--------------------------------
  4. !ifndef ATOMIC_ROOT
  5. !error "ATOMIC_ROOT NOT DEFINED"
  6. !endif
  7. !ifndef EDITOR_VERSION
  8. !error "EDITOR_VERSION NOT DEFINED"
  9. !endif
  10. !ifndef INSTALLER_NAME
  11. !error "INSTALLER_NAME NOT DEFINED"
  12. !endif
  13. !define prodname "Atomic Editor"
  14. !define coname "THUNDERBEAST GAMES LLC"
  15. !define outfile "${ATOMIC_ROOT}\Artifacts\Build\WindowsInstaller\${INSTALLER_NAME}"
  16. !define appexe "AtomicEditor.exe"
  17. !define produrl "http://www.atomicgameengine.com/"
  18. ;--------------------------------
  19. ;Include Modern UI
  20. ;--------------------------------
  21. !include "MUI.nsh"
  22. !define MUI_HEADERIMAGE
  23. !define MUI_HEADERIMAGE_RIGHT
  24. !define MUI_HEADERIMAGE_BITMAP "Windows_Installer_Header.bmp"
  25. !define MUI_WELCOMEFINISHPAGE_BITMAP "Windows_Installer_LeftImage.bmp"
  26. !define MUI_HEADERIMAGE_UNBITMAP "Windows_Installer_Header.bmp"
  27. !define MUI_HEADER_TRANSPARENT_TEXT
  28. ;--------------------------------
  29. ;General
  30. ;--------------------------------
  31. ;Name and file
  32. Name "${prodname}"
  33. OutFile "${outfile}"
  34. RequestExecutionLevel admin
  35. ;Default installation folder
  36. InstallDir "$PROGRAMFILES64\${prodname}"
  37. ;Get installation folder from registry if available
  38. InstallDirRegKey HKLM "Software\${coname}\InstallDir" "${prodname}"
  39. ;--------------------------------
  40. ;Interface Settings
  41. ;--------------------------------
  42. !define MUI_ABORTWARNING
  43. ;--------------------------------
  44. ;Pages
  45. ;--------------------------------
  46. !insertmacro MUI_PAGE_WELCOME
  47. !insertmacro MUI_PAGE_DIRECTORY
  48. !insertmacro MUI_PAGE_INSTFILES
  49. ; These indented statements modify settings for MUI_PAGE_FINISH
  50. !define MUI_FINISHPAGE_NOAUTOCLOSE
  51. !define MUI_FINISHPAGE_RUN "$INSTDIR\AtomicEditor\${appexe}"
  52. !define MUI_FINISHPAGE_RUN_CHECKED
  53. !define MUI_FINISHPAGE_RUN_TEXT "Launch the Atomic Editor"
  54. !insertmacro MUI_PAGE_FINISH
  55. !insertmacro MUI_UNPAGE_CONFIRM
  56. !insertmacro MUI_UNPAGE_INSTFILES
  57. ;--------------------------------
  58. ;Languages
  59. ;--------------------------------
  60. !insertmacro MUI_LANGUAGE "English"
  61. ;--------------------------------
  62. ;Installer Sections
  63. ;--------------------------------
  64. Section "${prodname}" SecMain
  65. SetShellVarContext all
  66. SetOutPath "$INSTDIR"
  67. File /r "${ATOMIC_ROOT}\Artifacts\Build\WindowsEditor\*.*"
  68. ;Store installation folder
  69. WriteRegStr HKLM "Software\${coname}\InstallDir" "${prodname}" $INSTDIR
  70. ; Create shortcut
  71. CreateShortCut "$DESKTOP\${prodname}.lnk" "$INSTDIR\AtomicEditor\${appexe}"
  72. CreateShortCut "$SMPROGRAMS\${prodname}.lnk" "$INSTDIR\AtomicEditor\${appexe}"
  73. ; Update Add/Remove Programs
  74. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}"
  75. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "DisplayName" "${prodname}"
  76. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "UninstallString" "$INSTDIR\Uninstall.exe"
  77. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "InstallLocation" "$INSTDIR"
  78. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "DisplayIcon" "$INSTDIR\AtomicEditor\${appexe},0"
  79. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "Publisher" "${coname}"
  80. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "URLInfoAbout" "${produrl}"
  81. WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "NoRepair" 1
  82. WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "NoModify" 1
  83. ;Create uninstaller
  84. WriteUninstaller "$INSTDIR\Uninstall.exe"
  85. SectionEnd
  86. ;--------------------------------
  87. ;Uninstaller Section
  88. ;--------------------------------
  89. Section "Uninstall"
  90. SetShellVarContext all
  91. ; Remove short cut
  92. Delete "$SMPROGRAMS\${prodname}.lnk"
  93. Delete "$DESKTOP\${prodname}.lnk"
  94. ; Remove installation folder
  95. RMDir /r $INSTDIR
  96. ; Remove from Add/Remove Programs
  97. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}"
  98. ; Remove installation folder
  99. DeleteRegValue HKLM "Software\${coname}\InstallDir" "${prodname}"
  100. DeleteRegKey /ifempty HKLM "Software\${coname}\InstallDir"
  101. DeleteRegKey /ifempty HKLM "Software\${coname}"
  102. SectionEnd