Rollup merge of #90166 - smmalis37:patch-1, r=joshtriplett

Add comment documenting why we can't use a simpler solution

See #90144 for context.

r? ```@joshtriplett```
This commit is contained in:
Matthias Krüger 2021-10-23 05:28:28 +02:00 committed by GitHub
commit a05a1294d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -281,6 +281,10 @@ pub fn temp_dir() -> PathBuf {
#[cfg(not(target_vendor = "uwp"))]
fn home_dir_crt() -> Option<PathBuf> {
unsafe {
// The magic constant -4 can be used as the token passed to GetUserProfileDirectoryW below
// instead of us having to go through these multiple steps to get a token. However this is
// not implemented on Windows 7, only Windows 8 and up. When we drop support for Windows 7
// we can simplify this code. See #90144 for details.
use crate::sys::handle::Handle;
let me = c::GetCurrentProcess();