From 8bba404e59036e2d41f3adf15396ca56db669ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 2 Apr 2019 21:22:37 +0200 Subject: [PATCH 1/2] fix: Check for "rustup" rather than ".rustup" when checking for wasm32 When checking for wasm32 target we did check if the sysroot contained ".rustup". While this covered the most common cases it didn't work when using Docker. So checking for "rustup" instead covers both cases. --- src/build/wasm_target.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/build/wasm_target.rs b/src/build/wasm_target.rs index ccd3c4bc..f6897587 100644 --- a/src/build/wasm_target.rs +++ b/src/build/wasm_target.rs @@ -24,7 +24,7 @@ impl fmt::Display for Wasm32Check { let rustup_string = if self.is_rustup { "It looks like Rustup is being used.".to_owned() } else { - format!("It looks like Rustup is not being used. For non-Rustup setups, the {} target needs to be installed manually. See https://rustwasm.github.io/wasm-pack/book/prerequisites/index.html#target-wasm32-unknown-unknown on how to do this.", target) + format!("It looks like Rustup is not being used. For non-Rustup setups, the {} target needs to be installed manually. See https://rustwasm.github.io/wasm-pack/book/prerequisites/non-rustup-setups.html on how to do this.", target) }; writeln!( @@ -111,9 +111,9 @@ fn check_wasm32_target() -> Result { }) // If it doesn't exist, then we need to check if we're using rustup. } else { - // If sysroot contains .rustup, then we can assume we're using rustup + // If sysroot contains "rustup", then we can assume we're using rustup // and use rustup to add the wasm32-unknown-unknown target. - if sysroot.to_string_lossy().contains(".rustup") { + if sysroot.to_string_lossy().contains("rustup") { rustup_add_wasm_target().map(|()| Wasm32Check { rustc_path, sysroot, From 6a0f2fb247ad3be756e463df8a8ccd309a559c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesper=20H=C3=A5kansson?= Date: Tue, 2 Apr 2019 21:45:09 +0200 Subject: [PATCH 2/2] fix: Print other message if we could not find the target --- src/build/wasm_target.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build/wasm_target.rs b/src/build/wasm_target.rs index f6897587..27fb2cad 100644 --- a/src/build/wasm_target.rs +++ b/src/build/wasm_target.rs @@ -20,7 +20,7 @@ impl fmt::Display for Wasm32Check { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let target = "wasm32-unknown-unknown"; - if self.found { + if !self.found { let rustup_string = if self.is_rustup { "It looks like Rustup is being used.".to_owned() } else {