mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-06 12:48:20 +00:00
Normalize path
This commit is contained in:
@@ -1137,7 +1137,7 @@ fn link_exe_from_dir(
|
|||||||
include_dirs.dedup();
|
include_dirs.dedup();
|
||||||
for include_dir in include_dirs {
|
for include_dir in include_dirs {
|
||||||
cmd.arg("-I");
|
cmd.arg("-I");
|
||||||
cmd.arg(format!("{}", include_dir.display()));
|
cmd.arg(normalize_path(&format!("{}", include_dir.display())));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut include_path = library_path.clone();
|
let mut include_path = library_path.clone();
|
||||||
@@ -1145,7 +1145,7 @@ fn link_exe_from_dir(
|
|||||||
include_path.pop();
|
include_path.pop();
|
||||||
include_path.push("include");
|
include_path.push("include");
|
||||||
cmd.arg("-I");
|
cmd.arg("-I");
|
||||||
cmd.arg(format!("{}", include_path.display()));
|
cmd.arg(normalize_path(&format!("{}", include_path.display())));
|
||||||
|
|
||||||
if !zig_triple.contains("windows") {
|
if !zig_triple.contains("windows") {
|
||||||
cmd.arg("-lunwind");
|
cmd.arg("-lunwind");
|
||||||
@@ -1161,11 +1161,11 @@ fn link_exe_from_dir(
|
|||||||
cmd.args(
|
cmd.args(
|
||||||
&object_paths
|
&object_paths
|
||||||
.iter()
|
.iter()
|
||||||
.map(|o| format!("{}", o.display()))
|
.map(|o| normalize_path(&format!("{}", o.display())))
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
);
|
);
|
||||||
cmd.arg(&format!("{}", library_path.display()));
|
cmd.arg(&normalize_path(&format!("{}", library_path.display())));
|
||||||
cmd.arg(format!(
|
cmd.arg(normalize_path(&format!(
|
||||||
"{}",
|
"{}",
|
||||||
directory
|
directory
|
||||||
.join(match entrypoint.object_format {
|
.join(match entrypoint.object_format {
|
||||||
@@ -1175,7 +1175,7 @@ fn link_exe_from_dir(
|
|||||||
.canonicalize()
|
.canonicalize()
|
||||||
.expect("could not find wasmer_main.c / wasmer_main.o")
|
.expect("could not find wasmer_main.c / wasmer_main.o")
|
||||||
.display()
|
.display()
|
||||||
));
|
)));
|
||||||
|
|
||||||
if zig_triple.contains("windows") {
|
if zig_triple.contains("windows") {
|
||||||
let mut winsdk_path = library_path.clone();
|
let mut winsdk_path = library_path.clone();
|
||||||
@@ -1186,7 +1186,7 @@ fn link_exe_from_dir(
|
|||||||
let files_winsdk = std::fs::read_dir(winsdk_path)
|
let files_winsdk = std::fs::read_dir(winsdk_path)
|
||||||
.ok()
|
.ok()
|
||||||
.map(|res| {
|
.map(|res| {
|
||||||
res.filter_map(|r| Some(format!("{}", r.ok()?.path().display())))
|
res.filter_map(|r| Some(normalize_path(&format!("{}", r.ok()?.path().display()))))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
})
|
})
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
@@ -1227,6 +1227,14 @@ fn link_exe_from_dir(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn normalize_path(s: &str) -> String {
|
||||||
|
if s.starts_with("\\\\?\\") {
|
||||||
|
s.replacen("\\\\?\\", "", 1)
|
||||||
|
} else {
|
||||||
|
s.to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Link compiled objects using the system linker
|
/// Link compiled objects using the system linker
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn link_objects_system_linker(
|
fn link_objects_system_linker(
|
||||||
|
|||||||
Reference in New Issue
Block a user