Function homedir::windows::get_my_home

source ·
pub fn get_my_home() -> Result<Option<PathBuf>, GetHomeError>
Expand description

Get the home directory of the process’ user.

This function uses the SHGetKnownFolderPath function to get the profile directory path of the current user.

Example

use homedir::get_my_home;

// This assumes that the current process' user's profile directory path is
// "C:\Users\jpetersen".
assert_eq!(
    std::path::Path::new("C:\\Users\\jpetersen"),
    get_my_home().unwrap().unwrap(),
);