DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
MCP: the several-roots tests expect Windows paths without the \\?\ prefix
dotCooCoo1f613f8c66eb
diff --git a/apps/designcraft-cli/tests/it/cli.rs b/apps/designcraft-cli/tests/it/cli.rsindex 467b231f6..8e73fc314 100644--- a/apps/designcraft-cli/tests/it/cli.rs+++ b/apps/designcraft-cli/tests/it/cli.rs@@ -411,8 +411,14 @@ fn mcp_automation_roots_take_several_folders() {for d in ["in", "shared", "out", "scratch", "outside", "in2", "scratch2"] {std::fs::create_dir_all(base.join(d)).unwrap();}- // Resolved, as the server shows the roots (`/var` is `/private/var` on macOS).+ // Resolved, as the server shows the roots (`/var` is `/private/var` on macOS), and without the+ // `\\?\` prefix that `canonicalize` adds on Windows: the server shows the roots without it, and+ // Windows does not resolve `..` in a path that has it.let base = std::fs::canonicalize(base).unwrap();+ let base = match base.to_str().and_then(|t| t.strip_prefix(r"\\?\")) {+ Some(rest) => std::path::PathBuf::from(rest),+ None => base,+ };for f in ["in/a.designcraft", "shared/b.designcraft", "outside/secret.designcraft", "parent.designcraft", "in2/c.designcraft"] {make_document(&base.join(f));}diff --git a/crates/engine/src/file_access.rs b/crates/engine/src/file_access.rsindex 31d61e382..17c6526d1 100644--- a/crates/engine/src/file_access.rs+++ b/crates/engine/src/file_access.rs@@ -412,9 +412,11 @@ mod tests {/// siblings `in2` and `scratch2` whose names start like a root's, and a file in their parent./// The folder is returned resolved (`/var` is `/private/var` on macOS), as the roots show it, so/// a path that passes only because it was resolved is the case being tested and nothing else.+ /// It has no `\\?\` prefix on Windows, where the roots are shown without it and `..` is not+ /// resolved in a path that has it.fn several(name: &str) -> (PathBuf, Arc<AutomationRoots>) {let (base, _) = folders(name);- let base = std::fs::canonicalize(base).unwrap();+ let base = plain(std::fs::canonicalize(base).unwrap());for d in ["shared", "scratch", "scratch2"] {std::fs::create_dir_all(base.join(d)).unwrap();}@@ -492,7 +494,7 @@ mod tests {assert!(e.starts_with("cannot open the automation write root"), "{e}");// A folder given twice (here once through `..`) counts once.let twice = AutomationRoots::new(&[&base.join("in"), &base.join("in/sub/.."), &base.join("in")], &[]).unwrap().unwrap();- let real = std::fs::canonicalize(&base).unwrap();+ let real = plain(std::fs::canonicalize(&base).unwrap());assert_eq!(twice.describe(), format!("read {}; write none", s(real.join("in"))));let e = twice.check(s(base.join("outside/x")), Access::Read).unwrap_err();assert!(e.contains("outside the read root ") && !e.contains("roots"), "{e}");