diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 66bed3510..611be8af9 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -16,6 +16,7 @@ travis-ci = { repository = "uutils/uucore" } appveyor = { repository = "uutils/uucore" } [dependencies] +dunce = "1.0.0" getopts = "0.2.18" failure = { version = "0.1.1", optional = true } failure_derive = { version = "0.1.1", optional = true } @@ -43,4 +44,3 @@ entries = ["libc"] zero-copy = ["nix", "libc", "lazy_static", "platform-info"] wide = [] default = [] - diff --git a/src/uucore/src/fs.rs b/src/uucore/src/fs.rs index 65819afcc..39d4b1f5a 100644 --- a/src/uucore/src/fs.rs +++ b/src/uucore/src/fs.rs @@ -6,6 +6,8 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#[cfg(windows)] +extern crate dunce; #[cfg(target_os = "redox")] extern crate termion; @@ -101,7 +103,7 @@ pub fn canonicalize>(original: P, can_mode: CanonicalizeMode) -> let original = if original.is_absolute() { original.to_path_buf() } else { - env::current_dir().unwrap().join(original) + dunce::canonicalize(env::current_dir().unwrap()).unwrap().join(original) }; let mut result = PathBuf::new();