fix(app): installer removes only its own files and stops on failed steps

- installer.sh lists every packaged file for the uninstaller, and folders
  are removed only when empty, so a chosen folder keeps other files.
- A virtual monitor driver removal that fails stops the uninstall with
  everything kept (silent exit code 4); the elevated half exits 2 when
  there is no driver of ours to remove, which the uninstaller accepts.
- WebView2 is installed before any file is copied; when it is still
  missing the installer asks to retry, or silently stops with code 3
  without installing or starting anything.
- The installer holds Global\JarvisBotSetup while it runs; jarvis.exe
  started meanwhile shows a message and exits before any window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-14 11:26:28 +09:00
parent 5ce832f51a
commit 1ae2521d58
7 changed files with 192 additions and 33 deletions

View File

@@ -11,8 +11,13 @@ sh "$here/package.sh" "$out" >/dev/null
# The WebView2 runtime's bootstrapper (Microsoft, about 2 MB), run only on a PC without the runtime.
wv2="$target/MicrosoftEdgeWebview2Setup.exe"
[ -s "$wv2" ] || curl -fsSL -o "$wv2" "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
# What the uninstaller removes: exactly the files installed under python-src and display-driver,
# then their folders, deepest first, each only when empty.
list="$target/uninstall-list.nsh"
(cd "$out/Jarvis" && find python-src display-driver -type f | sort | sed 's|/|\\|g; s|^| Delete "$INSTDIR\\|; s|$|"|'
cd "$out/Jarvis" && find python-src display-driver -type d | sort -r | sed 's|/|\\|g; s|^| RMDir "$INSTDIR\\|; s|$|"|') > "$list"
setup="$out/Jarvis-Setup-$version.exe"
makensis -V2 -DVERSION="$version" -DSRC="$out/Jarvis" -DOUT="$setup" -DICON="$here/icons/icon.ico" \
-DWEBVIEW2="$wv2" "$here/installer.nsi"
-DWEBVIEW2="$wv2" -DUNINSTALL_LIST="$list" ${NSIS_EXTRA:-} "$here/installer.nsi"
(cd "$out" && sha256sum "Jarvis-Setup-$version.exe" > "Jarvis-Setup-$version.exe.sha256")
echo "$setup"