custom_sprites 
The account's drawing sidecar, custom_sprites.json beside preferences.json, with verified writes and a recovery backup.
Vars | |
| dirty | Includes changes from other targets/slots after a failed disk save. |
|---|---|
| last_good_json | The verified prior file, never replaced with a corrupt primary during recovery. |
| last_save_failed | Whether the last write failed and still needs a retry. |
| pending_removed_entries | Deleted identities must also be removed from the recovery copy before acknowledging a save. |
Procs | |
| load | Loads each slot's entry from the primary, or from the backup when the primary is missing or unreadable. Loading neither leaves last_good_json null, so save() refuses and the files on disk stay as they are. |
| load_entries | Copies the entries this file keeps from its decoded JSON into the tree, for load(). |
| read_snapshot | The parent JSON store logs malformed JSON; an optional drawing sidecar must fail quietly. |
| save | Writes the tree when it has changed or the last write failed, and returns whether the file on disk now holds it. |
| write_file | Writes contents to destination and returns rust-g's error text, empty on success. Tests override it to fail. |
| write_verified | rust-g returns error text, not a success boolean; a full readback also catches short writes. |
Var Details
dirty 
Includes changes from other targets/slots after a failed disk save.
last_good_json 
The verified prior file, never replaced with a corrupt primary during recovery.
last_save_failed 
Whether the last write failed and still needs a retry.
pending_removed_entries 
Deleted identities must also be removed from the recovery copy before acknowledging a save.
Proc Details
load
Loads each slot's entry from the primary, or from the backup when the primary is missing or unreadable. Loading neither leaves last_good_json null, so save() refuses and the files on disk stay as they are.
load_entries
Copies the entries this file keeps from its decoded JSON into the tree, for load().
The drawing sidecar keeps one entry per character slot. A subtype that keeps other entries overrides this.
Arguments:
- decoded: The file's decoded JSON.
read_snapshot
The parent JSON store logs malformed JSON; an optional drawing sidecar must fail quietly.
save
Writes the tree when it has changed or the last write failed, and returns whether the file on disk now holds it.
The new JSON is staged and verified first. Then the backup is made to hold the last verified revision, and the primary is written and verified. Deleted slots are scrubbed from the backup before success is reported.
write_file
Writes contents to destination and returns rust-g's error text, empty on success. Tests override it to fail.
write_verified
rust-g returns error text, not a success boolean; a full readback also catches short writes.