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

pub fn expand<T: AsRef<Path>>(path: T) -> Result<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 = env::var("HOME").unwrap();
assert_eq!(PathBuf::from(&home).mash("foo"), PathBuf::from("~/foo").expand().unwrap());