|
|
|
@ -103,14 +103,14 @@ impl Storage {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn load_plan_at_path(path: PathBuf, save_local: bool) -> Option<Plan> {
|
|
|
|
|
let plan: Plan = match serde_json::from_str(&std::fs::read_to_string(&path).ok()?).ok() {
|
|
|
|
|
let mut plan: Plan = match serde_json::from_str(&std::fs::read_to_string(&path).ok()?).ok() {
|
|
|
|
|
Some(plan) => plan,
|
|
|
|
|
None => convert_old(path.clone())?,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if save_local {
|
|
|
|
|
match Self::save_plan_at_store_path(path.file_name()?.to_str()?, plan.clone(), false) {
|
|
|
|
|
Ok(_) => (),
|
|
|
|
|
Ok(path) => plan.set_stored_path(Some(path)),
|
|
|
|
|
Err(_e) => {
|
|
|
|
|
log::error!("Could not save plan at store path during load");
|
|
|
|
|
}
|
|
|
|
@ -149,9 +149,6 @@ impl Storage {
|
|
|
|
|
log::info!("Overwriting plan : {file_path:?}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TODO: Determine necessity
|
|
|
|
|
plan.set_stored_path(Some(file_path.clone()));
|
|
|
|
|
|
|
|
|
|
std::fs::write(&file_path, serde_json::to_string(&plan)?)?;
|
|
|
|
|
|
|
|
|
|
Ok(file_path.clone())
|
|
|
|
|