From 65b9a5b500d5af9450ce47add08c0a41bb754082 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sun, 12 Nov 2023 21:55:47 +0530 Subject: [PATCH] Use relative path for local builds on Windows --- deno_bindgen_cli/main.rs | 11 ++++++++--- e2e_test/bindings/mod.ts | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/deno_bindgen_cli/main.rs b/deno_bindgen_cli/main.rs index 808d762..4f24ed5 100644 --- a/deno_bindgen_cli/main.rs +++ b/deno_bindgen_cli/main.rs @@ -30,9 +30,14 @@ fn main() -> std::io::Result<()> { let name = cargo::metadata()?; println!("Initializing {name}"); - unsafe { - dlfcn::load_and_init(&PathBuf::from(path), opt.out, opt.lazy_init)? - }; + let path = PathBuf::from(path); + // https://github.com/denoland/deno/issues/21172 + #[cfg(target_os = "windows")] + let path = path + .strip_prefix(&cwd) + .expect("path is not a prefix of cwd"); + + unsafe { dlfcn::load_and_init(&path, opt.out, opt.lazy_init)? }; println!("Ready {name}"); Ok(()) diff --git a/e2e_test/bindings/mod.ts b/e2e_test/bindings/mod.ts index 4071862..2801917 100644 --- a/e2e_test/bindings/mod.ts +++ b/e2e_test/bindings/mod.ts @@ -5,7 +5,7 @@ const { dlopen } = Deno; -const { symbols } = dlopen('/Users/divy/gh/deno_bindgen/e2e_test/target/debug/libdeno_bindgen_e2e.dylib', { +const { symbols } = dlopen('target/debug/libdeno_bindgen_e2e.dylib', { add: { parameters: [ 'i32',