Skip to content

Commit ee056cc

Browse files
committed
better way to get an absolute path
1 parent b245786 commit ee056cc

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

cargo-miri/bin.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -259,19 +259,8 @@ fn setup(subcommand: MiriCommand) {
259259
let rust_src = match std::env::var_os("XARGO_RUST_SRC") {
260260
Some(val) => {
261261
let path = PathBuf::from(val);
262-
let path = path.canonicalize().unwrap_or(path);
263-
264-
// On Windows, this produces a path starting with `\\?\`, which xargo cannot deal with.
265-
// Strip that prefix; the resulting path should still be valid.
266-
#[cfg(windows)]
267-
let path = {
268-
let str = path.into_os_string().into_string()
269-
.expect("non-unicode paths are currently not supported");
270-
let str = str.strip_prefix(r"\\?\").map(String::from).unwrap_or(str);
271-
PathBuf::from(str)
272-
};
273-
274-
path
262+
// Make path absolute, but not via `canonicalize` (which does not work very well on Windows).
263+
env::current_dir().unwrap().join(path)
275264
}
276265
None => {
277266
// Check for `rust-src` rustup component.

0 commit comments

Comments
 (0)