Skip to content

Commit

Permalink
Try to fix issue with missing samba drives (qarmin#1096)
Browse files Browse the repository at this point in the history
* GA

* GA

* GA

* GAS

* KDV

* ASG

* Wa

* BKF

* Fmt
  • Loading branch information
qarmin authored Oct 16, 2023
1 parent 59ff9f3 commit 99277b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ flatpak/
ci_tester/target
ci_tester/Cargo.lock
czkawka_slint_gui/Cargo.lock
czkawka_slint_gui/target
czkawka_slint_gui/target
*.json
20 changes: 14 additions & 6 deletions czkawka_core/src/common_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,21 @@ impl Directories {
}

// Try to canonicalize them
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);
// 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;
}
}
(Some(directory), messages)
Expand Down

0 comments on commit 99277b9

Please sign in to comment.