From 87f60b880bd1ce586972f9b70dd6c627b1df92cd Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Mon, 10 Aug 2026 01:20:53 -0700 Subject: simpler include paths for assets in the output directory Force-Push: yes Change-Id: Iecc7163cab1bcfe3b4b6fa8f8f648e87f514b706 --- build.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index a6c5756..fcd166d 100644 --- a/build.rs +++ b/build.rs @@ -186,11 +186,17 @@ fn generate_asset_module(asset_paths: BTreeSet) -> Result<()> { } else { Path::new(&source_dir).join(&asset_path).to_path_buf() }; + let mut include_path = include_path.to_path_buf(); - include_path = include_path.strip_prefix(&source_dir)?.to_path_buf(); - for _ in Path::new(&out_dir).strip_prefix(&source_dir)?.components() { - include_path = Path::new("../").join(include_path).to_path_buf(); + if include_path.starts_with(&out_dir) { + include_path = include_path.strip_prefix(&out_dir)?.to_path_buf(); + } else { + include_path = include_path.strip_prefix(&source_dir)?.to_path_buf(); + for _ in Path::new(&out_dir).strip_prefix(&source_dir)?.components() { + include_path = Path::new("../").join(include_path).to_path_buf(); + } } + let include_path = include_path .to_str() .ok_or(Error("Can't stringify path - weird filesystem?" -- cgit 1.4.1