Skip to content
Source
Sign inSign up

installer.nsh

42 lines1.7 KB

1!include "StrFunc.nsh"
2!ifdef BUILD_UNINSTALLER
3 ${UnStrRep}
4 !define T3StrRep '${UnStrRep}'
5!else
6 ${StrRep}
7 !define T3StrRep '${StrRep}'
8!endif
9​
10!macro customAppRunningMessages
11 Push $0
12 Push $1
13 ${If} $IsPowerShellAvailable == 0
14 System::Call 'kernel32::SetEnvironmentVariable(t "T3CODE_INSTALL_DIR", t "$INSTDIR")'
15 nsExec::ExecToStack `"$PowerShellPath" -NoProfile -NonInteractive -C "Get-CimInstance -ClassName Win32_Process | Where-Object { $$_.ExecutablePath -and [IO.Path]::GetDirectoryName($$_.ExecutablePath) -eq $$env:T3CODE_INSTALL_DIR } | ForEach-Object { [IO.Path]::GetFileNameWithoutExtension($$_.ExecutablePath) } | Where-Object { $$_ -in 'T3 Code (Alpha)', 'T3 Code (Beta)', 'T3 Code (Nightly)' } | Select-Object -First 1 | ForEach-Object { [Console]::Write($$_) }"`
16 Pop $0
17 Pop $1
18 System::Call 'kernel32::SetEnvironmentVariable(t "T3CODE_INSTALL_DIR", p 0)'
19 ${If} $0 == 0
20 ${If} $1 == "T3 Code (Alpha)"
21 ${OrIf} $1 == "T3 Code (Beta)"
22 ${OrIf} $1 == "T3 Code (Nightly)"
23 ${T3StrRep} $appRunningMessage $appRunningMessage "${PRODUCT_NAME}" $1
24 ${T3StrRep} $appClosingMessage $appClosingMessage "${PRODUCT_NAME}" $1
25 ${T3StrRep} $appCannotBeClosedMessage $appCannotBeClosedMessage "${PRODUCT_NAME}" $1
26 ${EndIf}
27 ${EndIf}
28 ${EndIf}
29 Pop $1
30 Pop $0
31!macroend
32​
33!macro customInstall
34 !ifndef DO_NOT_CREATE_START_MENU_SHORTCUT
35 ${IfNot} ${FileExists} "$newStartMenuLink"
36 !insertmacro createMenuDirectory
37 CreateShortCut "$newStartMenuLink" "$appExe" "" "$appExe" 0 "" "" "${APP_DESCRIPTION}"
38 ClearErrors
39 WinShell::SetLnkAUMI "$newStartMenuLink" "${APP_ID}"
40 ${EndIf}
41 !endif
42!macroend