Skip to main content

home_dir

Function home_dir 

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

Returns the user’s home directory.

On non-Windows platforms this reads $HOME. On Windows, %USERPROFILE% is tried first, then $HOME as a fallback (matching shell environments such as Git Bash that set HOME).

Only absolute paths are accepted; a relative value is rejected so files never land relative to the current working directory. Returns None when no suitable variable is set or the resolved path is relative.