From 7b467f668663ea67a0569b4439245097cce797a4 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Sun, 8 Nov 2026 08:55:34 -0500 Subject: [PATCH] Let the setup repair a launcher that updated itself and can no longer start. The setup left the folder alone whenever app/current.txt named a newer version than its own, so after an update "Run NX2navi-Setup.exe again to repair the installation" did nothing when python\ or that version's launcher was gone (deleted, quarantined). A newer install is now kept only when its launcher and Python are there; otherwise the setup unpacks its own release. Co-Authored-By: Claude Opus 5.5 --- launcher/native/setup.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/launcher/native/setup.c b/launcher/native/setup.c index 30151617..dac4989b 100644 --- a/launcher/native/setup.c +++ b/launcher/native/setup.c @@ -230,12 +230,24 @@ static int unzip(void) /* ---------------------------------------------------------------- the work */ +/* The installed release ver can start: its launcher (launcher/native/nx2navi.c release_ok) and the Python it runs on. */ +static int installed_ok(const wchar_t *dest, const wchar_t *ver) +{ + wchar_t p[PATHN]; + swprintf(p, PATHN, L"%ls\\app\\%ls\\launcher\\start.pyw", dest, ver); + if (!ver[0] || !path_exists(p)) return 0; + swprintf(p, PATHN, L"%ls\\python\\pythonw.exe", dest); + return path_exists(p); +} + static DWORD WINAPI work(void *arg) { wchar_t cur[PATHN], have[64]; (void)arg; swprintf(cur, PATHN, L"%ls\\app\\current.txt", S.dest); - int newer_installed = read_line(cur, have, 64) && version_cmp(have, S.version) > 0; + /* A newer launcher (one that updated itself) stays, unless it cannot start: the stub sends the player to this + setup to repair just that, and the setup's own release then replaces it. */ + int newer_installed = read_line(cur, have, 64) && version_cmp(have, S.version) > 0 && installed_ok(S.dest, have); wchar_t probe[PATHN]; swprintf(probe, PATHN, L"%ls\\x", S.dest); if (!make_dirs(probe)) {