From 5ed4723f976082d0f12e013b6830797deb4e1d81 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Thu, 11 Jan 2024 18:13:54 -0700 Subject: [PATCH] Use dunce crate to get non-UNC paths when calling canonicalize https://github.com/rust-lang/rust/issues/42869#issuecomment-1712317081 --- Cargo.lock | 1 + src/dfx-core/Cargo.toml | 1 + src/dfx-core/src/fs/mod.rs | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 0a57aa5be0..697148c70e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1485,6 +1485,7 @@ dependencies = [ "clap", "dialoguer", "directories-next", + "dunce", "flate2", "hex", "humantime-serde", diff --git a/src/dfx-core/Cargo.toml b/src/dfx-core/Cargo.toml index f1b9fef3f3..c55966067d 100644 --- a/src/dfx-core/Cargo.toml +++ b/src/dfx-core/Cargo.toml @@ -17,6 +17,7 @@ candid = { workspace = true, features = ["random"] } clap = { workspace = true, features = ["string"] } dialoguer = "0.10.0" directories-next.workspace = true +dunce = "1.0" flate2 = { workspace = true, default-features = false, features = ["zlib-ng"] } hex = { workspace = true, features = ["serde"] } humantime-serde = "1.1.1" diff --git a/src/dfx-core/src/fs/mod.rs b/src/dfx-core/src/fs/mod.rs index 83eb3d412c..adddaf3d49 100644 --- a/src/dfx-core/src/fs/mod.rs +++ b/src/dfx-core/src/fs/mod.rs @@ -11,7 +11,7 @@ use std::fs::{Metadata, Permissions, ReadDir}; use std::path::{Path, PathBuf}; pub fn canonicalize(path: &Path) -> Result { - path.canonicalize() + dunce::canonicalize(path) .map_err(|err| FsError::new(CanonicalizePathFailed(path.to_path_buf(), err))) }