From 83a65664df8e865bd509718cf357403b44ada946 Mon Sep 17 00:00:00 2001 From: Zack Radisic <56137411+zackradisic@users.noreply.github.com> Date: Thu, 23 Sep 2021 17:28:14 +0300 Subject: [PATCH] don't call canonicalize when building for wasm use target_os=wasi --- types/src/importer.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/types/src/importer.rs b/types/src/importer.rs index 5a97a43c..373650e4 100644 --- a/types/src/importer.rs +++ b/types/src/importer.rs @@ -145,6 +145,11 @@ impl<'a> Importer<'a> { self.error(format!("failed to locate path: {}", key.path)); return Err(()); } + + #[cfg(target_os = "wasi")] + return Ok((path, import_path)); + + #[cfg(not(target_os = "wasi"))] match path.canonicalize() { Ok(p) => Ok((p, import_path)), Err(_) => { @@ -159,7 +164,13 @@ impl<'a> Importer<'a> { .config .get_working_dir() .ok() - .map(|x| x.canonicalize().ok()) + .map(|x| { + #[cfg(target_os = "wasi")] + return Some(x); + + #[cfg(not(target_os = "wasi"))] + x.canonicalize().ok() + }) .flatten(); match read_content(path) { Ok(contents) => {