Remove path_abs, use omnipath is better, :)

This commit is contained in:
Zhenping Zhao 2024-11-23 14:24:23 -08:00
parent c3b84abbf4
commit a7c9695944
2 changed files with 5 additions and 9 deletions

View File

@ -16,7 +16,6 @@ dirs = { workspace = true }
[target.'cfg(windows)'.dependencies]
omnipath = { workspace = true }
path_abs = "0.5.1"
[target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "android")))'.dependencies]
pwd = { workspace = true }

View File

@ -171,15 +171,12 @@ pub mod _impl {
}
fn get_full_path_name_w(path_str: &str) -> Option<String> {
use path_abs::PathAbs;
if let Ok(path_abs) = PathAbs::new(path_str) {
let full_path = path_abs.as_path().to_str()?;
// Remove the preceding \\?\ characters
if full_path.starts_with(r"\\?\") {
return Some(full_path[4..].to_string());
}
use omnipath::sys_absolute;
if let Ok(path_sys_abs) = sys_absolute(PathBuf::from(path_str).as_path()) {
Some(path_sys_abs.to_str()?.to_string())
} else {
None
}
None
}
use std::sync::{Mutex, OnceLock};