Skip to content

Commit

Permalink
Fixes #625 Support getting Windows SDK from the environment (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram authored Jan 4, 2022
1 parent 96c7e76 commit 030baed
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/windows_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,15 @@ mod impl_ {
// only need to bother checking x64, making this code a tiny bit simpler.
// Like we do for the Universal CRT, we sort the possibilities
// asciibetically to find the newest one as that is what vcvars does.
// Before doing that, we check the "WindowsSdkDir" and "WindowsSDKVersion"
// environment variables set by vcvars to use the environment sdk version
// if one is already configured.
fn get_sdk10_dir() -> Option<(PathBuf, String)> {
if let (Ok(root), Ok(version)) = (env::var("WindowsSdkDir"), env::var("WindowsSDKVersion"))
{
return Some((root.into(), version.trim_end_matches('\\').to_string()));
}

let key = r"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0";
let key = LOCAL_MACHINE.open(key.as_ref()).ok()?;
let root = key.query_str("InstallationFolder").ok()?;
Expand Down

0 comments on commit 030baed

Please sign in to comment.