Skip to main content

home_dir

Function home_dir 

Source
pub fn home_dir() -> Option<PathBuf>
Expand description

Resolve the user’s home directory.

Prefers the HOME env var (Unix) or USERPROFILE (Windows) when set, falling back to dirs::home_dir() otherwise. The fallback on Windows calls a Win32 API that ignores environment overrides, which makes integration tests that point HOME/USERPROFILE at a tempdir useless. Honouring the env vars first restores parity with Unix behaviour and is harmless in production: real users on Windows have USERPROFILE set to their actual profile path anyway.