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

@ -90,15 +90,7 @@ impl FilesystemShell {
}
pub fn homedir_if_possible() -> Option<PathBuf> {
#[cfg(feature = "dirs")]
{
dirs_next::home_dir()
}
#[cfg(not(feature = "dirs"))]
{
None
}
dirs_next::home_dir()
}
impl Shell for FilesystemShell {

View File

@ -31,16 +31,11 @@ where
// path on all supported systems.
relative_to.as_ref().to_owned()
} else if path.as_ref().starts_with("~") {
#[cfg(feature = "dirs")]
{
let expanded_path = expand_tilde(path.as_ref());
match expanded_path {
Some(p) => p,
_ => path.as_ref().to_owned(),
}
let expanded_path = expand_tilde(path.as_ref());
match expanded_path {
Some(p) => p,
_ => path.as_ref().to_owned(),
}
#[cfg(not(feature = "dirs"))]
relative_to.as_ref().join(path)
} else {
relative_to.as_ref().join(path)
};
@ -85,7 +80,6 @@ where
}
// borrowed from here https://stackoverflow.com/questions/54267608/expand-tilde-in-rust-path-idiomatically
#[cfg(feature = "dirs")]
pub fn expand_tilde<P: AsRef<Path>>(path_user_input: P) -> Option<PathBuf> {
let p = path_user_input.as_ref();
if !p.starts_with("~") {