DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Integration: next's file reads go through the checked readers
aiongg02a0023edc31
diff --git a/crates/engine/src/cmd/load_styles.rs b/crates/engine/src/cmd/load_styles.rsindex b2893c693..19a5a6794 100644--- a/crates/engine/src/cmd/load_styles.rs+++ b/crates/engine/src/cmd/load_styles.rs@@ -82,7 +82,7 @@ impl Kind {fn source(p: &Value, id: &str) -> Result<Document> {let (bytes, name) = match (str_param(p, "path"), str_param(p, "base64")) {(_, Some(b)) => (super::file::base64_decode(b), str_param(p, "name").unwrap_or("").to_string()),- (Some(path), None) => (std::fs::read(path).map_err(|e| bad(id, format!("{path}: {e}")))?, path.to_string()),+ (Some(path), None) => (crate::io::read_file(path).map_err(|e| bad(id, e))?, path.to_string()),_ => return Err(bad(id, "give `path` or `base64`")),};if name.to_lowercase().ends_with(".idml") {diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rsindex c6fa89796..790545ca9 100644--- a/crates/ui-egui/src/chrome.rs+++ b/crates/ui-egui/src/chrome.rs@@ -1005,7 +1005,7 @@ fn recent_file_stat_at(ctx: &egui::Context, path: &str, now: f64) -> RecentStat{return st;}- let meta = std::fs::metadata(path).ok().filter(std::fs::Metadata::is_file);+ let meta = designcraft_engine::io::metadata(path).ok().filter(designcraft_engine::io::Metadata::is_file);let st = RecentStat { exists: meta.is_some(), modified: meta.and_then(|m| m.modified().ok()), checked: now };ctx.data_mut(|d| d.insert_temp(key, st.clone()));stdiff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 0c4d7a408..58c8384ed 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -1298,7 +1298,7 @@ impl DesignApp {return self.run("swatch.load", json!({"path": path}));}let document = opens_as_document(path)- || (std::path::Path::new(path).extension().is_none() && std::fs::read(path).is_ok_and(|b| designcraft_engine::cmd::is_document(&b)));+ || (std::path::Path::new(path).extension().is_none() && designcraft_engine::io::read(path).is_ok_and(|b| designcraft_engine::cmd::is_document(&b)));if document {return self.open_file("file.open", json!({"path": path}));}