mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-26 09:28:09 +00:00
Read roots: links.findFiles and image.info follow the configured read roots
With automation read roots in force, links.findFiles and text.findFontFiles replies, including later polls and stops of a search another client started, leave out the files found outside the caller's read roots, a sought link's saved path outside them and the folder searched when it is outside them. A failed search then gives its reason without the path. The rows keep their names, ids and status, and the counts stay. image.info gives link: null for a linked file outside the read roots, as links.info does. text.addFontFiles gives folder: null when the Fonts folder is outside the read roots and names the copies there by their file names; the fonts are still copied. Docs: docs/mcp.md, docs/target-app-parity.md.
This commit is contained in:
@@ -71,6 +71,13 @@ fn a_found_font_is_copied_without_replacing_a_file_and_its_type_redraws() {
|
||||
assert!(st.revision > revision && !st.is_dirty());
|
||||
assert_eq!(s.execute("text.missingFonts", &json!({})).unwrap()["count"], 0);
|
||||
|
||||
// A caller whose read roots hold the file but not the Fonts folder: the file is kept, and the
|
||||
// reply names the copy by its file name only, without the folder.
|
||||
let downloads = vectorcraft_engine::file_access::AutomationRoots::new(&[&root.join("Downloads")], &[]).unwrap();
|
||||
let r = vectorcraft_engine::file_access::confine(downloads.as_ref(), || s.execute("text.addFontFiles", &json!({"files": [file]}))).unwrap();
|
||||
assert_eq!((&r["folder"], &r["kept"]), (&Value::Null, &json!([{"from": file, "to": "Findme 2.otf"}])), "{r}");
|
||||
assert!(!r.to_string().contains("App Fonts"), "{r}");
|
||||
|
||||
// The same file again is kept, not copied a third time.
|
||||
let r = s.execute("text.addFontFiles", &json!({"files": [file]})).unwrap();
|
||||
assert_eq!((r["copied"].clone(), r["kept"].clone()), (json!([]), json!([{"from": file, "to": fonts.join("Findme 2.otf")}])), "{r}");
|
||||
|
||||
Reference in New Issue
Block a user