mirror of
https://github.com/sxyazi/yazi.git
synced 2024-11-24 09:53:12 +03:00
feat: support expanding Windows paths like "D:" that only have a drive letter but no root (#948)
This commit is contained in:
parent
8456d3a7dc
commit
1a3565963c
@ -3,7 +3,9 @@ cargo publish -p yazi-config
|
||||
cargo publish -p yazi-proxy
|
||||
cargo publish -p yazi-adaptor
|
||||
cargo publish -p yazi-boot
|
||||
cargo publish -p yazi-dds
|
||||
cargo publish -p yazi-scheduler
|
||||
cargo publish -p yazi-plugin
|
||||
cargo publish -p yazi-core
|
||||
cargo publish -p yazi-fm
|
||||
cargo publish -p yazi-cli
|
||||
|
@ -19,7 +19,7 @@ parking_lot = "0.12.1"
|
||||
percent-encoding = "2.3.1"
|
||||
ratatui = "=0.26.1"
|
||||
regex = "1.10.4"
|
||||
serde = "1.0.198"
|
||||
serde = { version = "1.0.198", features = [ "derive" ] }
|
||||
tokio = { version = "1.37.0", features = [ "full" ] }
|
||||
|
||||
# Logging
|
||||
|
@ -26,6 +26,15 @@ fn _expand_path(p: &Path) -> PathBuf {
|
||||
env::var(name.as_str()).unwrap_or_else(|_| caps.get(0).unwrap().as_str().to_owned())
|
||||
});
|
||||
|
||||
// Windows paths that only have a drive letter but no root, e.g. "D:"
|
||||
#[cfg(windows)]
|
||||
if s.len() == 2 {
|
||||
let b = s.as_bytes();
|
||||
if b[1] == b':' && b[0].is_ascii_alphabetic() {
|
||||
return PathBuf::from(s.to_uppercase() + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
let p = Path::new(s.as_ref());
|
||||
if let Ok(rest) = p.strip_prefix("~") {
|
||||
#[cfg(unix)]
|
||||
|
@ -26,6 +26,7 @@ pub use errors::*;
|
||||
pub use layer::*;
|
||||
pub use natsort::*;
|
||||
pub use number::*;
|
||||
#[cfg(unix)]
|
||||
pub use os::*;
|
||||
pub use ro_cell::*;
|
||||
pub use throttle::*;
|
||||
|
Loading…
Reference in New Issue
Block a user