[][src]Function librelic::prelude::sys::expand

pub fn expand<T>(path: T) -> Result<PathBuf, FuError> where
    T: AsRef<Path>, 

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());