pub fn home_dir() -> Option<PathBuf>Expand description
User home directory, or None if it can’t be determined.
- macOS / Linux:
$HOME, falling back togetpwuid_r - Windows:
%USERPROFILE%(viadirs)
This function accounts for sudo scenarios where $HOME might be /root but we want the actual user’s home directory.
Prefer this over std::env::var("HOME") — the latter returns None
on stock Windows and sends us down a fallback path that then hits
/tmp (also nonexistent on Windows).