Try to fix issue with missing samba drives (#1096)
* GA * GA * GA * GAS * KDV * ASG * Wa * BKF * Fmt
This commit is contained in:
parent
59ff9f3e3c
commit
99277b9ea5
2 changed files with 16 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -17,3 +17,4 @@ ci_tester/target
|
|||
ci_tester/Cargo.lock
|
||||
czkawka_slint_gui/Cargo.lock
|
||||
czkawka_slint_gui/target
|
||||
*.json
|
|
@ -122,14 +122,22 @@ impl Directories {
|
|||
}
|
||||
|
||||
// Try to canonicalize them
|
||||
|
||||
if cfg!(windows) {
|
||||
// Only canonicalize if it's not a network path
|
||||
// This can be check by checking if path starts with \\?\UNC\
|
||||
if let Ok(dir_can) = directory.canonicalize() {
|
||||
let dir_can_str = dir_can.to_string_lossy().to_string();
|
||||
if let Some(dir_can_str) = dir_can_str.strip_prefix(r"\\?\") {
|
||||
if dir_can_str.chars().nth(1) == Some(':') {
|
||||
directory = PathBuf::from(dir_can_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if let Ok(dir) = directory.canonicalize() {
|
||||
directory = dir;
|
||||
}
|
||||
if cfg!(windows) {
|
||||
let path_str = directory.to_string_lossy().to_string();
|
||||
if let Some(path_str) = path_str.strip_prefix(r"\\?\") {
|
||||
directory = PathBuf::from(path_str);
|
||||
}
|
||||
}
|
||||
(Some(directory), messages)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue