#home-dir #xdg #home

xdg-home

The user's home directory as per XDG Specification

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

#146 in Filesystem

Download history 103715/week @ 2025-01-04 113972/week @ 2025-01-11 116867/week @ 2025-01-18 132484/week @ 2025-01-25 150552/week @ 2025-02-01 239448/week @ 2025-02-08 231669/week @ 2025-02-15 260582/week @ 2025-02-22 288269/week @ 2025-03-01 278407/week @ 2025-03-08 268668/week @ 2025-03-15 253391/week @ 2025-03-22 244748/week @ 2025-03-29 238172/week @ 2025-04-05 191793/week @ 2025-04-12 163138/week @ 2025-04-19

878,330 downloads per month
Used in 514 crates (7 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
~52K SLoC