fix(settings): an unreadable settings.json is kept as settings.json.broken, and the home says so #170

Merged
HumanBean merged 2 commits from madebyjordan/LongshotLauncher:fix/settings-broken-kept into main 2026-11-17 20:36:12 +00:00
Member

A corrupt settings.json loaded as defaults with no word, and the next save overwrote it: the player's builds folder, build-files folder and kept folders were gone, and with a custom builds folder the save gather then looked in the wrong place. builds.json already handles this; settings.json now does the same.

What changes

  • LauncherSettings.Load: an unreadable file (bad JSON, empty, null) is copied byte for byte to settings.json.broken, the defaults load, and the reason goes in a new Problem field that is never saved. It copies rather than renames on purpose: the settings load twice at start (App.axaml.cs, then LauncherService), and a rename would leave nothing for the second load to report.
  • The home shows "The launcher's settings could not be read (kept as settings.json.broken): {0}" under the builds.json notice. Translated into all 12 catalogs plus es-419, after the builds.json key.
  • A missing file is not broken. An older file with unknown fields (prepareShaders) still loads with no notice and no .broken file; the existing check now also requires that.

Testing

Windows 11, .NET SDK 10.0.404.

  • python -I tests/test_launcher_core.py: the check commit fails on main with An unreadable settings.json is kept as settings.json.broken, byte for byte., and passes with the fix. Checks: the .broken copy has the same bytes and the next save leaves it alone; missing is not broken; empty and null are broken, as builds.json treats them.
  • On Windows the suite stops early on main itself (short 8.3 TEMP paths in ShellLink and a few Linux-layout checks); every check group was run separately on main and on the branch: the same four groups fail on both, none of them touched here. CI on Linux is the judge.

Not tested: the notice in the window.

🤖 Generated with Claude Code

A corrupt `settings.json` loaded as defaults with no word, and the next save overwrote it: the player's builds folder, build-files folder and kept folders were gone, and with a custom builds folder the save gather then looked in the wrong place. `builds.json` already handles this; `settings.json` now does the same. ## What changes - **`LauncherSettings.Load`**: an unreadable file (bad JSON, empty, `null`) is copied byte for byte to `settings.json.broken`, the defaults load, and the reason goes in a new `Problem` field that is never saved. It copies rather than renames on purpose: the settings load twice at start (`App.axaml.cs`, then `LauncherService`), and a rename would leave nothing for the second load to report. - **The home** shows "The launcher's settings could not be read (kept as settings.json.broken): {0}" under the builds.json notice. Translated into all 12 catalogs plus es-419, after the builds.json key. - A missing file is not broken. An older file with unknown fields (`prepareShaders`) still loads with no notice and no `.broken` file; the existing check now also requires that. ## Testing Windows 11, .NET SDK 10.0.404. - `python -I tests/test_launcher_core.py`: the check commit fails on main with `An unreadable settings.json is kept as settings.json.broken, byte for byte.`, and passes with the fix. Checks: the `.broken` copy has the same bytes and the next save leaves it alone; missing is not broken; empty and `null` are broken, as builds.json treats them. - On Windows the suite stops early on main itself (short 8.3 TEMP paths in ShellLink and a few Linux-layout checks); every check group was run separately on main and on the branch: the same four groups fail on both, none of them touched here. CI on Linux is the judge. Not tested: the notice in the window. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A corrupt settings.json loads as the defaults and the next save writes them over it: the builds folder, the build files'
folder and the kept folders are lost without a word. builds.json is already kept aside as builds.json.broken with a notice
on the home; this check asks the same of settings.json. It fails on main: no settings.json.broken is kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(settings): an unreadable settings.json is kept as settings.json.broken, and the home says so
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
e67de28767
A corrupt settings.json loaded as the defaults without a word, and the next save wrote them over it: the builds folder,
the build files' folder and the kept folders were lost. It is now handled as builds.json is (BuildRegistry.Load): copied
aside as settings.json.broken, the defaults loaded, and LauncherSettings.Problem says why, which the home shows beside the
list of builds' notice. A missing file is still the first start, not a broken one; an empty or "null" file is broken, as
an empty builds.json is. Problem is not saved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean force-pushed fix/settings-broken-kept from e67de28767
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
to 9ec6040c56
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
2026-11-17 20:35:53 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!170
No description provided.