blob: 5217a113edcdce35fda907d3d4974d51e6f870a5 (
plain) (
tree)
|
|
;--------------------------------
;Include Modern UI
;http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html
!include "MUI2.nsh"
;--------------------------------
;General
;Name and file
Name "ManaLauncher"
OutFile "InstallManaLauncher.exe"
!define MUI_ICON "assets\media\icon.ico"
;Default installation folder
InstallDir "$PROGRAMFILES\ManaLauncher"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\LawnCablesManaLauncher" ""
;Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "LICENSE"
;!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
Function finishpageaction
CreateShortcut "$Desktop\LawnCablesManaLauncher.lnk" "$INSTDIR\LawnCablesManaLauncher.exe"
FunctionEnd
!define MUI_FINISHPAGE_RUN $INSTDIR\LawnCablesManaLauncher.exe
!define MUI_FINISHPAGE_RUN_TEXT "Launch ManaLauncher"
!define MUI_FINISHPAGE_SHOWREADME ""
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction
!insertmacro MUI_PAGE_FINISH
!define MUI_PAGE_CUSTOMFUNCTION_SHOW un.ModifyUnWelcome
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.LeaveUnWelcome
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
Var checkbox
var CheckboxState
Function un.onInit
StrCpy $CheckboxState ${BST_CHECKED}
FunctionEnd
Function un.ModifyUnWelcome
${NSD_CreateCheckbox} 120u -20u 50% 20u "Keep Gamedata and Configuration Files"
Pop $checkbox
SetCtlColors $checkbox "" ${MUI_BGCOLOR}
${NSD_SetState} $checkbox $CheckboxState
FunctionEnd
Function un.LeaveUnWelcome
${NSD_GetState} $checkbox $CheckboxState
FunctionEnd
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
!define REG_UNISTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\LawnCablesManaLauncher"
Section "Install"
SetOutPath "$INSTDIR"
File /r "out\LawnCablesManaLauncher-win32-x64\*"
File "assets\media\icon.ico"
;Store installation folder
WriteRegStr HKCU "Software\LawnCablesManaLauncher" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM ${REG_UNISTALL_KEY} "DisplayName" "LawnCable's ManaLauncher"
WriteRegStr HKLM ${REG_UNISTALL_KEY} "Publisher" "TMW2.ORG -> ManaLauncher Team"
WriteRegStr HKLM ${REG_UNISTALL_KEY} "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM ${REG_UNISTALL_KEY} "DisplayIcon" "$\"$INSTDIR\icon.ico$\""
WriteRegStr HKLM ${REG_UNISTALL_KEY} "URLInfoAbout" "https://tmw2.org"
WriteRegDWORD HKLM ${REG_UNISTALL_KEY} "NoModify" 1
WriteRegDWORD HKLM ${REG_UNISTALL_KEY} "NoRepair" 1
WriteRegStr HKLM ${REG_UNISTALL_KEY} "UpdateInfo" "https://tmw2.org"
;Create shortcut
CreateShortcut "$SMPROGRAMS\LawnCablesManaLauncher.lnk" "$INSTDIR\LawnCablesManaLauncher.exe"
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
RMDir /r "$INSTDIR"
${If} $CheckboxState <> ${BST_CHECKED}
RMDir /r "$APPDATA\mana-launcher"
${EndIf}
Delete "$Desktop\LawnCablesManaLauncher.lnk"
Delete "$SMPROGRAMS\LawnCablesManaLauncher.lnk"
DeleteRegKey /ifempty HKCU "Software\LawnCablesManaLauncher"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LawnCablesManaLauncher"
Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR"
SectionEnd
|