Remove dir-s/ectories/ectories-support features (#3647)

This commit is contained in:
Jakub Žádník
2021-06-19 02:29:29 +03:00
committed by GitHub
parent bd44bcee32
commit 4140834e4c
14 changed files with 20 additions and 102 deletions

View File

@ -17,8 +17,5 @@ nu-protocol = { version = "0.32.1", path = "../nu-protocol" }
nu-source = { version = "0.32.1", path = "../nu-source" }
nu-test-support = { version = "0.32.1", path = "../nu-test-support" }
dirs-next = { version = "2.0.0", optional = true }
dirs-next = "2.0.0"
indexmap = { version = "1.6.1", features = ["serde-1"] }
[features]
dirs = ["dirs-next"]

View File

@ -26,19 +26,12 @@ impl PathCompleter {
let base_dir = if base_dir_name.is_empty() {
PathBuf::from(".")
} else {
#[cfg(feature = "dirs")]
{
let home_prefix = format!("~{}", SEP);
if base_dir_name.starts_with(&home_prefix) {
let mut home_dir = dirs_next::home_dir().unwrap_or_else(|| PathBuf::from("~"));
home_dir.push(&base_dir_name[2..]);
home_dir
} else {
PathBuf::from(base_dir_name)
}
}
#[cfg(not(feature = "dirs"))]
{
let home_prefix = format!("~{}", SEP);
if base_dir_name.starts_with(&home_prefix) {
let mut home_dir = dirs_next::home_dir().unwrap_or_else(|| PathBuf::from("~"));
home_dir.push(&base_dir_name[2..]);
home_dir
} else {
PathBuf::from(base_dir_name)
}
};