mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-09-12 21:57:19 -04:00
File.WriteAllText truncates the destination before writing, so an interrupted write leaves a half-written or empty Settings.json, and the in-process lock added in the previous commit cannot help a reader in another process - the GUI and the CLI share this file. Route every write through Dinah.Core.IO.AtomicFileWriter, which writes a sibling temp file, flushes to disk and renames it over the destination. Validate the temp file parses as json before the swap, the same way JsonFilePersister<T> already saves AccountsSettings.json, so a bad payload leaves the existing file untouched. Co-authored-by: rmcrackan <rmcrackan@gmail.com>