AtomicEditor.nsi 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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\Dist\${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. ; The installer runs in elevated mode, NSIS doesn't have a way
  51. ; without plugins to run the installed application in normal user mode
  52. ; so disabling launch checkbox, look into a MSI replacement
  53. ;!define MUI_FINISHPAGE_NOAUTOCLOSE
  54. ;!define MUI_FINISHPAGE_RUN "$INSTDIR\${appexe}"
  55. ;!define MUI_FINISHPAGE_RUN_CHECKED
  56. ;!define MUI_FINISHPAGE_RUN_TEXT "Launch the Atomic Editor"
  57. !insertmacro MUI_PAGE_FINISH
  58. !insertmacro MUI_UNPAGE_CONFIRM
  59. !insertmacro MUI_UNPAGE_INSTFILES
  60. ;--------------------------------
  61. ;Languages
  62. ;--------------------------------
  63. !insertmacro MUI_LANGUAGE "English"
  64. ;--------------------------------
  65. ;Installer Sections
  66. ;--------------------------------
  67. Section "${prodname}" SecMain
  68. SetShellVarContext all
  69. SetOutPath "$INSTDIR"
  70. File /r "${ATOMIC_ROOT}\Artifacts\AtomicEditor\*.*"
  71. ;Store installation folder
  72. WriteRegStr HKLM "Software\${coname}\InstallDir" "${prodname}" $INSTDIR
  73. ; Create shortcut
  74. CreateShortCut "$DESKTOP\${prodname}.lnk" "$INSTDIR\${appexe}"
  75. CreateShortCut "$SMPROGRAMS\${prodname}.lnk" "$INSTDIR\${appexe}"
  76. ; Update Add/Remove Programs
  77. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}"
  78. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "DisplayName" "${prodname}"
  79. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "UninstallString" "$INSTDIR\Uninstall.exe"
  80. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "InstallLocation" "$INSTDIR"
  81. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "DisplayIcon" "$INSTDIR\${appexe},0"
  82. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "Publisher" "${coname}"
  83. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "URLInfoAbout" "${produrl}"
  84. WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "NoRepair" 1
  85. WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}" "NoModify" 1
  86. ;Create uninstaller
  87. WriteUninstaller "$INSTDIR\Uninstall.exe"
  88. SectionEnd
  89. ;--------------------------------
  90. ;Uninstaller Section
  91. ;--------------------------------
  92. Section "Uninstall"
  93. SetShellVarContext all
  94. ; Remove short cut
  95. Delete "$SMPROGRAMS\${prodname}.lnk"
  96. Delete "$DESKTOP\${prodname}.lnk"
  97. ; Remove installation folder
  98. RMDir /r $INSTDIR
  99. ; Remove from Add/Remove Programs
  100. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${prodname}"
  101. ; Remove installation folder
  102. DeleteRegValue HKLM "Software\${coname}\InstallDir" "${prodname}"
  103. DeleteRegKey /ifempty HKLM "Software\${coname}\InstallDir"
  104. DeleteRegKey /ifempty HKLM "Software\${coname}"
  105. SectionEnd