; Clean up the relocated terminal daemon on a REAL uninstall. ; ; Why: the daemon host is deliberately copied to a distinct image name ; (orca-terminal-daemon.exe) under %LOCALAPPDATA%\Orca\daemon-host so that app ; UPDATES cannot kill it — that relocation is what keeps terminals alive across ; updates. The same design means a normal uninstall's process sweep and file ; removal both miss it, leaving an orphaned daemon plus its runtime copy behind. ; ; The ${isUpdated} guard is essential: electron-builder runs this uninstaller as ; part of uninstallOldVersion on EVERY update, and killing the daemon there would ; defeat the whole feature. Only clean up on a genuine uninstall. ; ; The image name and the LOCALAPPDATA folder name must stay in sync with ; DAEMON_HOST_EXE_NAME and LOCAL_HOST_ROOT_NAME in ; src/main/daemon/daemon-host-relocation.ts. !macro customUnInstall ${ifNot} ${isUpdated} nsExec::Exec 'taskkill /F /IM orca-terminal-daemon.exe' ; Give the OS a moment to release the image lock before removing the tree. Sleep 500 RMDir /r "$LOCALAPPDATA\Orca\daemon-host" ${endIf} !macroend