try to strip prefix via string

This commit is contained in:
Folkert 2022-11-12 00:39:14 +01:00
parent e74ff3f50a
commit c556d96772
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 5 additions and 8 deletions

View file

@ -1208,18 +1208,12 @@ fn link_wasm32(
// include wasi libc
// using `-lc` is broken in zig 8 (and early 9) in combination with ReleaseSmall
wasi_libc_path.to_str().unwrap(),
&format!(
"-femit-bin={}",
output_path.display().to_string().trim_start_matches(r"\\?")
),
&format!("-femit-bin={}", output_path.display()),
"-target",
"wasm32-wasi-musl",
"--pkg-begin",
"str",
zig_str_path
.display()
.to_string()
.trim_start_matches(r"\\?"),
&zig_str_path.display().to_string(),
"--pkg-end",
"--strip",
"-O",

View file

@ -107,6 +107,9 @@ pub fn get_lib_path() -> Option<PathBuf> {
let exe_relative_str_path_opt = std::env::current_exe().ok();
if let Some(exe_relative_str_path) = exe_relative_str_path_opt {
let strip_windows_prefix = exe_relative_str_path.display().to_string();
let exe_relative_str_path =
std::path::Path::new(strip_windows_prefix.trim_start_matches(r"\\?\"));
let mut curr_parent_opt = exe_relative_str_path.parent();
// this differs for regular build and nix releases, so we check in multiple spots.