Skip to content

Commit baa71c0

Browse files
authored
Merge pull request #326 from Geobert/find_devenv_when_msbuild_tools_configured
special case for devenv.exe
2 parents d265c3b + c2242dc commit baa71c0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/windows_registry.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ pub fn find_tool(target: &str, tool: &str) -> Option<Tool> {
6565
return impl_::find_msbuild(target);
6666
}
6767

68+
if tool.contains("devenv") {
69+
return impl_::find_devenv(target);
70+
}
71+
6872
// If VCINSTALLDIR is set, then someone's probably already run vcvars and we
6973
// should just find whatever that indicates.
7074
if env::var_os("VCINSTALLDIR").is_some() {
@@ -622,6 +626,26 @@ mod impl_ {
622626
}
623627
}
624628

629+
pub fn find_devenv(target: &str) -> Option<Tool> {
630+
find_devenv_vs15(&target)
631+
}
632+
633+
fn find_devenv_vs15(target: &str) -> Option<Tool> {
634+
let key = r"SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7";
635+
LOCAL_MACHINE
636+
.open(key.as_ref())
637+
.ok()
638+
.and_then(|key| key.query_str("15.0").ok())
639+
.map(|path| {
640+
let path = PathBuf::from(path).join(r"Common7\IDE\devenv.exe");
641+
let mut tool = Tool::new(path);
642+
if target.contains("x86_64") {
643+
tool.env.push(("Platform".into(), "X64".into()));
644+
}
645+
tool
646+
})
647+
}
648+
625649
// see http://stackoverflow.com/questions/328017/path-to-msbuild
626650
pub fn find_msbuild(target: &str) -> Option<Tool> {
627651
// VS 15 (2017) changed how to locate msbuild

0 commit comments

Comments
 (0)