#path #user #expand #attempt #expanding

expanduser

attempts to expand ~ and ~user while creating a filesystem path

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

#466 in Filesystem

Download history 794/week @ 2023-12-14 849/week @ 2023-12-21 536/week @ 2023-12-28 502/week @ 2024-01-04 514/week @ 2024-01-11 475/week @ 2024-01-18 511/week @ 2024-01-25 424/week @ 2024-02-01 455/week @ 2024-02-08 496/week @ 2024-02-15 432/week @ 2024-02-22 402/week @ 2024-02-29 564/week @ 2024-03-07 584/week @ 2024-03-14 639/week @ 2024-03-21 521/week @ 2024-03-28

2,386 downloads per month
Used in 12 crates (11 directly)

CC-PDDC license

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.4–1.3MB
~24K SLoC