DriverPwdMap

This commit is contained in:
pegasus.cadence@gmail.com
2024-11-18 18:35:36 -08:00
parent ea6493c041
commit 9ec152d06d
2 changed files with 304 additions and 0 deletions

View File

@@ -21,6 +21,18 @@ fn expand_tilde_with_home(path: impl AsRef<Path>, home: Option<PathBuf>) -> Path
let path = path.as_ref();
if !path.starts_with("~") {
use nu_protocol::engine::state_driver_pwd:: {
need_expand_current_directory,
get_windows_absolute_path,
};
if need_expand_current_directory(path) {
if let Some(current_dir) = get_windows_absolute_path(path) {
//println!("Absolute path for {} is: {}", path.display(), current_dir);
return PathBuf::from(&current_dir)
} else {
println!("Failed to get absolute path for {}", path.display());
}
}
let string = path.to_string_lossy();
let mut path_as_string = string.as_ref().bytes();
return match path_as_string.next() {