fix(windows): check USERPROFILE env var for finding home directory (#24384)

This commit is contained in:
David Sherret 2024-07-01 18:17:17 -04:00 committed by GitHub
parent b0cd43b5f3
commit 6f30ef88a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 11 deletions

View file

@ -266,6 +266,12 @@ pub mod dirs {
}
pub fn home_dir() -> Option<PathBuf> {
if let Some(userprofile) = std::env::var_os("USERPROFILE") {
if !userprofile.is_empty() {
return Some(PathBuf::from(userprofile));
}
}
known_folder(&knownfolders::FOLDERID_Profile)
}
}