4 stable releases

1.3.0 Aug 9, 2024
1.2.0 Jun 8, 2024
1.1.0 Feb 4, 2024
1.0.0 Mar 28, 2023

#110 in Unix APIs

Download history 78324/week @ 2024-08-13 78695/week @ 2024-08-20 77049/week @ 2024-08-27 78963/week @ 2024-09-03 65139/week @ 2024-09-10 51316/week @ 2024-09-17 60682/week @ 2024-09-24 80603/week @ 2024-10-01 87292/week @ 2024-10-08 91908/week @ 2024-10-15 90487/week @ 2024-10-22 98966/week @ 2024-10-29 100288/week @ 2024-11-05 92270/week @ 2024-11-12 94430/week @ 2024-11-19 80375/week @ 2024-11-26

385,725 downloads per month
Used in 404 crates (6 directly)

MIT license

7KB
89 lines

xdg-home

Gets the user's home directory as per XDG Base Directory Specification.

This is almost the same as home (and dirs) crate, except it honors HOME environment variable on the Windows platform as well, which is conformant to the XDG Base Directory Specification.

Use it where the XDG Base Directory Specification is applicable, such as in D-Bus code.

Example

use xdg_home::home_dir;

let home = home_dir().unwrap();
assert!(home.is_absolute());
assert!(home.exists());
println!("Home directory: {}", home.display());

Dependencies

~0–8MB
~62K SLoC