Function expanduser::expanduser [−][src]
pub fn expanduser<S: AsRef<str>>(s: S) -> Result<PathBuf>
Takes a string-like thing and tries to turn it into a PathBuf while expanding ~
's and ~user
's
into the user's home directory
Example
extern crate expanduser; use expanduser::expanduser; let path = expanduser("~/path/to/directory")?; assert_eq!(path.display().to_string(), "/home/foo/path/to/directory");