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

#119 in Unix APIs

Download history 76727/week @ 2024-08-25 80435/week @ 2024-09-01 69502/week @ 2024-09-08 51034/week @ 2024-09-15 57035/week @ 2024-09-22 77157/week @ 2024-09-29 86534/week @ 2024-10-06 91220/week @ 2024-10-13 88950/week @ 2024-10-20 97427/week @ 2024-10-27 102660/week @ 2024-11-03 91299/week @ 2024-11-10 94856/week @ 2024-11-17 89476/week @ 2024-11-24 102411/week @ 2024-12-01 115877/week @ 2024-12-08

410,763 downloads per month
Used in 424 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–7.5MB
~57K SLoC