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