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

See #90144 for context.

r? @joshtriplett
This commit is contained in:
Steven
2021-10-22 09:55:32 -04:00
committed by GitHub
parent 68a698baf6
commit c736c2a3ae

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();