Skip to content

Commit 5bd5a24

Browse files
committed
try to fix windows?
1 parent 7db34a5 commit 5bd5a24

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/uutests/src/lib/util.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ use std::os::unix::process::CommandExt;
3838
use std::os::unix::process::ExitStatusExt;
3939
#[cfg(windows)]
4040
use std::os::windows::fs::{symlink_dir, symlink_file};
41-
#[cfg(windows)]
42-
use std::path::MAIN_SEPARATOR_STR;
41+
use std::path::MAIN_SEPARATOR;
4342
use std::path::{Path, PathBuf};
43+
#[cfg(windows)]
44+
use std::path::{MAIN_SEPARATOR, MAIN_SEPARATOR_STR};
4445
use std::process::{Child, Command, ExitStatus, Output, Stdio};
4546
use std::rc::Rc;
4647
use std::sync::mpsc::{self, RecvTimeoutError};
@@ -81,7 +82,7 @@ pub fn get_tests_binary() -> String {
8182
std::env::var("CARGO_BUILD_TARGET").unwrap_or_else(|_| String::from(""));
8283
if !triple.is_empty() {
8384
let triple_path = format!(
84-
"{}/{}/{}/coreutils",
85+
"{}{MAIN_SEPARATOR}{}{MAIN_SEPARATOR}{}{MAIN_SEPARATOR}coreutils",
8586
target_dir.display(),
8687
triple,
8788
debug_or_release
@@ -93,7 +94,7 @@ pub fn get_tests_binary() -> String {
9394
}
9495
}
9596
// Fallback to regular path
96-
let tmp = format!("{}/{}/coreutils", target_dir.display(), debug_or_release);
97+
let tmp = format!("{}{MAIN_SEPARATOR}{}{MAIN_SEPARATOR}coreutils", target_dir.display(), debug_or_release);
9798
log_info("1= tmp0", &tmp);
9899
return tmp;
99100
}
@@ -110,7 +111,7 @@ pub fn get_tests_binary() -> String {
110111
let triple = std::env::var("CARGO_BUILD_TARGET").unwrap_or_else(|_| String::from(""));
111112
if !triple.is_empty() {
112113
let triple_path = format!(
113-
"{}/target/{}/{}/coreutils",
114+
"{}{MAIN_SEPARATOR}target{MAIN_SEPARATOR}{}{MAIN_SEPARATOR}{}{MAIN_SEPARATOR}coreutils",
114115
manifest_dir.display(),
115116
triple,
116117
debug_or_release
@@ -121,7 +122,7 @@ pub fn get_tests_binary() -> String {
121122
}
122123
}
123124
let tmp = format!(
124-
"{}/target/{}/coreutils",
125+
"{}{MAIN_SEPARATOR}target{MAIN_SEPARATOR}{}{MAIN_SEPARATOR}coreutils",
125126
manifest_dir.display(),
126127
debug_or_release
127128
);

0 commit comments

Comments
 (0)