From 09481147b1ac560b0094a9bb30c8780b3e2139a8 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 17 Oct 2022 15:22:41 +0200 Subject: [PATCH] Use proper paths to handle dylib search path I don't trust the paths with '/' to hold up on Windows. --- tools/export-validator/build.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/export-validator/build.rs b/tools/export-validator/build.rs index 1c5020cd3..5b395e1bc 100644 --- a/tools/export-validator/build.rs +++ b/tools/export-validator/build.rs @@ -1,17 +1,18 @@ -use std::env; +use std::{env, path::PathBuf}; fn main() -> anyhow::Result<()> { let manifest_dir = env::var("CARGO_MANIFEST_DIR")?; - let libs_dir_relative = "lib3mf/libs"; - let libs_dir = format!("{manifest_dir}/{libs_dir_relative}"); + let mut libs_dir = PathBuf::from(manifest_dir); + libs_dir.push("lib3mf"); + libs_dir.push("libs"); // This is necessary to link against the dynamic library. - println!("cargo:rustc-link-search=native={libs_dir}"); + println!("cargo:rustc-link-search=native={}", libs_dir.display()); println!("cargo:rustc-link-lib=dylib=3mf"); // And this is necessary, so the linked library is found at runtime. - println!("cargo:rustc-link-arg=-Wl,-rpath,{libs_dir}"); + println!("cargo:rustc-link-arg=-Wl,-rpath,{}", libs_dir.display()); Ok(()) }