Migrate config load/save/atomic_write to bread_utils::tomlcfg

load_doc/save_doc/atomic_write's bodies now delegate to
bread_utils::tomlcfg and bread_utils::atomic (path dependency for now, see
the TODO in Cargo.toml) instead of owning the temp-then-rename +
.bak-before-overwrite logic locally. Public function names/signatures in
config/mod.rs are unchanged, so none of the ~10 call sites across
ui/views/*.rs needed touching.

This is the other half of tonight's earlier BOS fix pass: that pass gave
breadhelp/src/config.rs its own byte-for-byte copy of this exact logic
(its own doc comment says "same discipline as bos-settings/src/config/
mod.rs::atomic_write") rather than sharing it — breadhelp's migration
follows in the next commit.

Builds clean; all 11 existing tests pass, including the atomic-write
backup/no-leftover-tmp-file test that now exercises the delegated code.
This commit is contained in:
Breadway 2026-07-17 09:30:36 +08:00
parent da6af6abf9
commit f3a5839cf1
3 changed files with 21 additions and 49 deletions

11
Cargo.lock generated
View file

@ -32,6 +32,7 @@ version = "0.6.3"
dependencies = [
"async-channel",
"bread-theme",
"bread-utils",
"glib",
"gtk4",
"serde",
@ -51,6 +52,16 @@ dependencies = [
"serde_json",
]
[[package]]
name = "bread-utils"
version = "0.2.3"
dependencies = [
"dirs",
"serde",
"serde_json",
"toml_edit 0.22.27",
]
[[package]]
name = "cairo-rs"
version = "0.22.0"