From 51fd6166a7b92c106ec63f97d47b6dcedeb43183 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sun, 1 Nov 2026 15:04:39 +0700 Subject: [PATCH] Read the backslash path only on Windows in the build path test On Linux a backslash is part of a file name, so the read couldn't match there. --- crates/engine/src/tools/build_tools.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/tools/build_tools.rs b/crates/engine/src/tools/build_tools.rs index 5e610fdb..7da6abaf 100644 --- a/crates/engine/src/tools/build_tools.rs +++ b/crates/engine/src/tools/build_tools.rs @@ -392,7 +392,9 @@ mod tests { let r = call(&e, "build_file_write", json!({"path": "/app/package.json", "content": "{}"})).unwrap(); assert_eq!((r["written"].as_str(), r.get("note")), (Some("app/package.json"), None)); assert!(ws.app_dir().join("package.json").is_file()); - assert_eq!(call(&e, "build_file_read", json!({"path": "\\app\\package.json"})).unwrap()["text"], "{}\n"); + // Backslashes separate folders only on Windows; elsewhere they're part of a name. + let read = if cfg!(windows) { "\\app\\package.json" } else { "/app/package.json" }; + assert_eq!(call(&e, "build_file_read", json!({"path": read})).unwrap()["text"], "{}\n"); assert!(call(&e, "build_files_list", json!({"path": "/app"})).unwrap()["entries"].to_string().contains("app/package.json")); // A folder the project doesn't have stays outside it. assert!(call(&e, "build_file_read", json!({"path": "/etc/passwd"})).is_err());