mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-31 21:48:53 -06:00
- Library settings (prefs.json, presets.json, view.json): only a missing file means "defaults". A file that doesn't parse is kept as <name>.corrupt-<unix time> before the defaults are used; one that can't be read (locked, I/O error) is never written this session (save_prefs refuses, presets/view saves skip it). Warnings go to library.info → settingsWarnings and Session::take_library_warnings; the UI shows each once in a window (ui.inspect → notices, button:noticeOk). - Desktop ui.json (holds the library location): written atomically (temp + fsync + rename + dir fsync), saved as soon as the library path changes and every few seconds when it changed, failures reported; a damaged file is renamed to ui.json.corrupt-<time> and reported, an unreadable one is not overwritten. - Quit/close with changes only in memory: retry the save (log, then a snapshot of everything), and if it still fails cancel the close and ask: Try Saving Again / Quit Anyway / Cancel (ui.inspect → quitPrompt). - Tests: engine (damaged prefs kept, unreadable presets/prefs untouched), desktop (damaged ui.json kept, atomic write), headless UI (quit prompt buttons, settings notice). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>