Function env_home_dir

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

Returns the path of the current user’s home directory if known.

  • On Unix, this function will check the HOME environment variable
  • On Windows, it will check the USERPROFILE environment variable
  • On other platforms, this function will always return None
  • If the environment variable is unset, return None
  • If the environment variable is set to an empty string, return None

Note: the behavior of this function differs from std::env::home_dir, home::home_dir, and dirs::home_dir.

This function returns None when the environment variable is set but empty. Those implementations return the empty string "" instead.