Browse Source

special case for devenv.exe

wintest
Geobert Quach 7 years ago
parent
commit
fb70a6fd21
  1. 25
      src/windows_registry.rs

25
src/windows_registry.rs

@ -65,6 +65,10 @@ pub fn find_tool(target: &str, tool: &str) -> Option<Tool> {
return impl_::find_msbuild(target);
}
if tool.contains("devenv") {
return impl_::find_devenv(target);
}
// If VCINSTALLDIR is set, then someone's probably already run vcvars and we
// should just find whatever that indicates.
if env::var_os("VCINSTALLDIR").is_some() {
@ -622,6 +626,27 @@ mod impl_ {
}
}
pub fn find_devenv(target: &str) -> Option<Tool> {
find_devenv_vs15(&target)
}
fn find_devenv_vs15(target: &str) -> Option<Tool> {
let key = r"SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7";
LOCAL_MACHINE
.open(key.as_ref())
.ok()
.and_then(|key| key.query_str("15.0").ok())
.map(|path| {
let path = PathBuf::from(path).join(r"Common7\IDE\devenv.exe");
println!("*** path: {:?}", path);
let mut tool = Tool::new(path);
if target.contains("x86_64") {
tool.env.push(("Platform".into(), "X64".into()));
}
tool
})
}
// see http://stackoverflow.com/questions/328017/path-to-msbuild
pub fn find_msbuild(target: &str) -> Option<Tool> {
// VS 15 (2017) changed how to locate msbuild

Loading…
Cancel
Save