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