[][src]Function fungus::sys::expand

pub fn expand<T: AsRef<Path>>(path: T) -> FuResult<PathBuf>

Expand all environment variables in the path as well as the home directory.

WARNING: Does not expand partials e.g. "/foo${BAR}ing/blah" only complete components e.g. "/foo/${BAR}/blah"

Examples

use fungus::prelude::*;

let home = user::home_dir().unwrap();
assert_eq!(PathBuf::from(&home).mash("foo"), PathBuf::from("~/foo").expand().unwrap());