[][src]Function dirs::home_dir

pub fn home_dir() -> Option<PathBuf>

Returns the path to the user's home directory.

The returned value depends on the operating system and is either a Some, containing a value from the following table, or a `None.

Platform Value Example
Linux $HOME /home/alice
macOS $HOME /Users/Alice
Windows {FOLDERID_Profile} C:\Users\Alice

Linux and macOS:

Windows:

This function retrieves the user profile folder using SHGetKnownFolderPath.

All the examples on this page mentioning $HOME use this behavior.

Note: This function's behavior differs from std::env::home_dir, which works incorrectly on Linux, macOS and Windows.