From 4165e397d0f808fc6398713130967f8a13984935 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 24 Feb 2026 08:43:35 -0800 Subject: [PATCH] Fix absolute paths --- typst/private/process_wrapper/process_wrapper.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/typst/private/process_wrapper/process_wrapper.rs b/typst/private/process_wrapper/process_wrapper.rs index 79520a1..4314647 100644 --- a/typst/private/process_wrapper/process_wrapper.rs +++ b/typst/private/process_wrapper/process_wrapper.rs @@ -88,9 +88,21 @@ fn main() { fs::copy(src, &abs_dest).expect("Failed to copy file into build directory"); } + // Set --root to the workspace root so paths resolve relative to the + // workspace rather than the .typ file's parent directory. + let workspace_root = temp_runfiles_dir.join( + args.src + .1 + .iter() + .next() + .expect("src rlocationpath must have a workspace name component"), + ); + // Run the typst compiler let result = Command::new(&args.compiler) .arg("compile") + .arg("--root") + .arg(&workspace_root) .arg(&abs_src) .arg(&args.out) .output();