Skip to content

Commit fb70a6f

Browse files
author
Geobert Quach
committed
special case for devenv.exe
1 parent d265c3b commit fb70a6f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/windows_registry.rs

Lines changed: 25 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,27 @@ 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+
println!("*** path: {:?}", path);
642+
let mut tool = Tool::new(path);
643+
if target.contains("x86_64") {
644+
tool.env.push(("Platform".into(), "X64".into()));
645+
}
646+
tool
647+
})
648+
}
649+
625650
// see http://stackoverflow.com/questions/328017/path-to-msbuild
626651
pub fn find_msbuild(target: &str) -> Option<Tool> {
627652
// VS 15 (2017) changed how to locate msbuild

0 commit comments

Comments
 (0)