diff options
Diffstat (limited to 'vendor/gix-url/src/expand_path.rs')
-rw-r--r-- | vendor/gix-url/src/expand_path.rs | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/vendor/gix-url/src/expand_path.rs b/vendor/gix-url/src/expand_path.rs index 85fb0da50..e62a8b51e 100644 --- a/vendor/gix-url/src/expand_path.rs +++ b/vendor/gix-url/src/expand_path.rs @@ -22,7 +22,7 @@ impl From<ForUser> for Option<BString> { } } -/// The error used by [`parse()`], [`with()`] and [`expand_path()`]. +/// The error used by [`parse()`], [`with()`] and [`expand_path()`](crate::expand_path()). #[derive(Debug, thiserror::Error)] #[allow(missing_docs)] pub enum Error { @@ -112,16 +112,3 @@ pub fn with( None => path.into(), }) } - -/// Expand `path` for the given `user`, which can be obtained by [`parse()`], resolving the home directories -/// of `user` automatically. -/// -/// If more precise control of the resolution mechanism is needed, then use the [`with()`] function. -pub fn expand_path(user: Option<&ForUser>, path: &BStr) -> Result<PathBuf, Error> { - with(user, path, |user| match user { - ForUser::Current => home::home_dir(), - ForUser::Name(user) => { - home::home_dir().and_then(|home| home.parent().map(|home_dirs| home_dirs.join(user.to_string()))) - } - }) -} |