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 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}