Mountain/ApplicationState/Internal/Persistence/MementoLoader/
AttemptMementoRecovery.rs1
2use std::{fs, path::Path};
8
9use crate::dev_log;
10
11pub fn Fn(FilePath:&Path, CorruptedContent:&str) {
12 let BackupPath = FilePath.with_extension("json.backup");
13
14 match fs::write(&BackupPath, CorruptedContent) {
15 Ok(()) => {
16 dev_log!(
17 "storage",
18 "warn: [MementoLoader] Created backup of corrupted memento at: {}",
19 BackupPath.display()
20 )
21 },
22
23 Err(E) => {
24 dev_log!(
25 "storage",
26 "error: [MementoLoader] Failed to create backup of corrupted memento at '{}': {}",
27 BackupPath.display(),
28 E
29 )
30 },
31 }
32}