expanduser = "1.2"
attempts to expand ~ and ~user while creating a filesystem path
Repository Cargo Documentation Download
Similar to the python stdlib function os.path.expanduser, the function in this crate attempts to create a path while expanding ~
and ~user
.
Add the following to your Cargo.toml:
expanduser = "1.2"
and add this to your crate root:
extern crate expanduser;
extern crate expanduser; use std::io; use expanduser::expanduser; fn main() -> io::Result<()> { let path = expanduser("~/path/to/directory")?; assert_eq!(path.display().to_string(), "/home/foo/path/to/directory"); }