5 stable releases
Uses old Rust 2015
1.2.2 | Mar 25, 2021 |
---|---|
1.2.1 | Jul 11, 2018 |
1.1.0 | Jul 11, 2018 |
1.0.0 | Jun 5, 2018 |
#372 in Filesystem
32,673 downloads per month
Used in 24 crates
(23 directly)
7KB
101 lines
expanduser
Similar to the python stdlib function os.path.expanduser, the function in this crate attempts to create a path while expanding ~
and ~user
.
Installation
Add the following to your Cargo.toml:
expanduser = "1.2"
and add this to your crate root:
extern crate expanduser;
Usage
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");
}
Dependencies
~0.3–1.1MB
~20K SLoC