chore: minor changes to scene and app error logging
This commit is contained in:
1 parent
8683f8b565
commit
508a69d385
2 files changed
+13
-3
No files matched your search
+4
-1
@@ -573,7 +573,10 @@ impl App {
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.map_err(|e| format!("Failed to create instance: {e}"))
|
||||
.map_err(|e| {
|
||||
let err = e.unwrap();
|
||||
format!("Failed to create instance: {err}")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -1,5 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
|
||||
@@ -45,16 +46,22 @@ impl Scene {
|
||||
let scene: Self =
|
||||
postcard::from_bytes(contents.as_slice()).expect("Couldn't deserialize scene");
|
||||
|
||||
Self::resolve_paths(path, scene)
|
||||
env::set_current_dir(path.parent().unwrap())
|
||||
.expect("couldn't set current working directory");
|
||||
|
||||
scene
|
||||
}
|
||||
|
||||
pub fn from_file_json<P: AsRef<Path>>(path: P) -> Self {
|
||||
let path = path.as_ref();
|
||||
|
||||
let file = std::fs::File::open(path).unwrap();
|
||||
env::set_current_dir(path.parent().unwrap())
|
||||
.expect("couldn't set current working directory");
|
||||
|
||||
let scene: Self = serde_json::from_reader(file).unwrap();
|
||||
|
||||
Self::resolve_paths(path, scene)
|
||||
scene
|
||||
}
|
||||
|
||||
fn resolve_paths(scene_path: &Path, mut scene: Self) -> Self {
|
||||
|
||||
Reference in new issue
Block a user