Read launcher.json saved with a BOM, and keep a copy of one that is not valid JSON.

The docs ask players to edit the file by hand (github_token, feed_repo). A BOM, which an editor may add, made the
file unreadable and every setting, the game folder included, fell back to its default, so the launcher showed the
first run again; a typo did the same and the next save overwrote what the player wrote. The file is now read with
utf-8-sig, and a file that is still no JSON is copied to launcher.json.bad and named in the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-08 08:51:35 -05:00
parent aaea991191
commit c9f75ad0b2
3 changed files with 29 additions and 2 deletions

View File

@@ -29,6 +29,9 @@ class Context:
self._file = None
self.log(f'--- NX2navi launcher {self.version} ({"checkout" if self.layout.dev else "release"}) in '
f'{self.layout.root}')
if self.settings.unreadable:
self.log(f'{self.layout.settings} is not valid JSON: the settings start from their defaults; the file as '
'it was is kept as launcher.json.bad')
def log(self, line):
stamp = time.strftime('%H:%M:%S')