Open History to see the last commit
1!include "StrFunc.nsh"
2!ifdef BUILD_UNINSTALLER
3 ${UnStrRep}
4 !define T3StrRep '${UnStrRep}'
5!else
6 ${StrRep}
7 !define T3StrRep '${StrRep}'
8 Var t3AppWasRunning
9!endif
10
11!macro customAppRunningMessages
12 !ifndef BUILD_UNINSTALLER
13 StrCpy $t3AppWasRunning 1
14 !endif
15 Push $0
16 Push $1
17 ${If} $IsPowerShellAvailable == 0
18 System::Call 'kernel32::SetEnvironmentVariable(t "T3CODE_INSTALL_DIR", t "$INSTDIR")'
19 nsExec::ExecToStack /TIMEOUT=${POWERSHELL_TIMEOUT_MS} `"$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($$_) }"`
20 Pop $0
21 Pop $1
22 System::Call 'kernel32::SetEnvironmentVariable(t "T3CODE_INSTALL_DIR", p 0)'
23 ${If} $0 == 0
24 ${If} $1 == "T3 Code (Alpha)"
25 ${OrIf} $1 == "T3 Code (Beta)"
26 ${OrIf} $1 == "T3 Code (Nightly)"
27 ${T3StrRep} $appRunningMessage $appRunningMessage "${PRODUCT_NAME}" $1
28 ${T3StrRep} $appClosingMessage $appClosingMessage "${PRODUCT_NAME}" $1
29 ${T3StrRep} $appCannotBeClosedMessage $appCannotBeClosedMessage "${PRODUCT_NAME}" $1
30 ${EndIf}
31 ${EndIf}
32 ${EndIf}
33 Pop $1
34 Pop $0
35!macroend
36
37!macro customInstall
38 !ifndef DO_NOT_CREATE_START_MENU_SHORTCUT
39 ${IfNot} ${FileExists} "$newStartMenuLink"
40 !insertmacro createMenuDirectory
41 CreateShortCut "$newStartMenuLink" "$appExe" "" "$appExe" 0 "" "" "${APP_DESCRIPTION}"
42 ClearErrors
43 WinShell::SetLnkAUMI "$newStartMenuLink" "${APP_ID}"
44 ${EndIf}
45 !endif
46
47 # The template relaunches after a silent install only with --force-run, which WinGet does not pass.
48 ${If} ${Silent}
49 ${AndIfNot} ${isForceRun}
50 ${AndIf} $t3AppWasRunning == 1
51 HideWindow
52 ${StdUtils.ExecShellAsUser} $0 "$launchLink" "open" ""
53 ${EndIf}
54!macroend