From 57052a9aef08857c084782a90355cf66567c7fef Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Fri, 17 Mar 2023 22:06:02 +0100 Subject: [PATCH] windows: treat UNC paths --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/repofile/snapshotfile.rs | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7a95dfe..a053e10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -597,6 +597,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "dunce" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" + [[package]] name = "either" version = "1.8.1" @@ -1757,6 +1763,7 @@ dependencies = [ "derive_more", "directories", "dirs", + "dunce", "enum-map", "enum-map-derive", "filetime", diff --git a/Cargo.toml b/Cargo.toml index 4d5030b..e6ab439 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,6 +81,7 @@ rpassword = "7" bytesize = "1" indicatif = "0.17" path-dedot = "3" +dunce = "1" gethostname = "0.4" humantime = "2" itertools = "0.10" diff --git a/src/repofile/snapshotfile.rs b/src/repofile/snapshotfile.rs index 06ef5f7..0165464 100644 --- a/src/repofile/snapshotfile.rs +++ b/src/repofile/snapshotfile.rs @@ -7,6 +7,7 @@ use anyhow::{anyhow, bail, Result}; use chrono::{DateTime, Duration, Local}; use clap::{AppSettings, Parser}; use derivative::Derivative; +use dunce::canonicalize; use gethostname::gethostname; use indicatif::ProgressBar; use itertools::Itertools; @@ -634,7 +635,7 @@ impl PathList { } if self.0.iter().any(|p| p.is_absolute()) { for path in &mut self.0 { - *path = path.canonicalize()?; + *path = canonicalize(&path)?; } } Ok(())