diff --git a/src/windows_registry.rs b/src/windows_registry.rs index 0c542a7..84c2d84 100644 --- a/src/windows_registry.rs +++ b/src/windows_registry.rs @@ -65,6 +65,10 @@ pub fn find_tool(target: &str, tool: &str) -> Option { 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 { + find_devenv_vs15(&target) + } + + fn find_devenv_vs15(target: &str) -> Option { + 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 { // VS 15 (2017) changed how to locate msbuild