fn find_tool_in_vs15_path(tool: &str, target: &str) -> Option<Tool> {
        let mut path = match vs15plus_instances(target) {
            Some(instances) => instances
                .into_iter()
                .filter_map(|instance| instance.installation_path())
                .map(|path| path.join(tool))
                .find(|ref path| path.is_file()),
            None => None,
        };

        if path.is_none() {
            let key = r"SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7";
            path = LOCAL_MACHINE
                .open(key.as_ref())
                .ok()
                .and_then(|key| key.query_str("15.0").ok())
                .map(|path| PathBuf::from(path).join(tool))
                .and_then(|path| if path.is_file() { Some(path) } else { None });
        }

        path.map(|path| {
            let mut tool = Tool::with_family(path, MSVC_FAMILY);
            if target.contains("x86_64") {
                tool.env.push(("Platform".into(), "X64".into()));
            }
            if target.contains("aarch64") {
                tool.env.push(("Platform".into(), "ARM64".into()));
            }
            tool
        })
    }
// While the paths to Visual Studio 2017's devenv and MSBuild could
// potentially be retrieved from the registry, finding them via
// SetupConfiguration has shown to be [more reliable], and is preferred
// according to Microsoft. To help head off potential regressions though,
// we keep the registry method as a fallback option.
//
// [more reliable]: https://github.com/alexcrichton/cc-rs/pull/331
While the paths to Visual Studio 2017's devenv and MSBuild could
potentially be retrieved from the registry, finding them via
SetupConfiguration has shown to be [more reliable], and is preferred
according to Microsoft. To help head off potential regressions though,
we keep the registry method as a fallback option.


While the paths to Visual Studio 2017 ' s devenv and MSBuild could potentially be retrieved from the registry finding them via SetupConfiguration has shown to be [ more reliable ] and is preferred according to Microsoft . To help head off potential regressions though we keep the registry method as a fallback option .
fn find_tool_in_vs15_path(tool: &str, target: &str) -> Option<Tool> {
        let mut path = match vs15plus_instances(target) {
            Some(instances) => instances
                .into_iter()
                .filter_map(|instance| instance.installation_path())
                .map(|path| path.join(tool))
                .find(|ref path| path.is_file()),
            None => None,
        };
        if path.is_none() {
            let key = r"SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7";
            path = LOCAL_MACHINE
                .open(key.as_ref())
                .ok()
                .and_then(|key| key.query_str("15.0").ok())
                .map(|path| PathBuf::from(path).join(tool))
                .and_then(|path| if path.is_file() { Some(path) } else { None });
        }
        path.map(|path| {
            let mut tool = Tool::with_family(path, MSVC_FAMILY);
            if target.contains("x86_64") {
                tool.env.push(("Platform".into(), "X64".into()));
            }
            if target.contains("aarch64") {
                tool.env.push(("Platform".into(), "ARM64".into()));
            }
            tool
        })
    }
fn find_tool_in_vs15_path ( tool : & str , target : & str ) -> Option < Tool > { let mut path = match vs15plus_instances ( target ) { Some ( instances ) => instances . into_iter ( ) . filter_map ( | instance | instance . installation_path ( ) ) . map ( | path | path . join ( tool ) ) . find ( | ref path | path . is_file ( ) ) , None => None , } ; if path . is_none ( ) { let key = r"SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7" ; path = LOCAL_MACHINE . open ( key . as_ref ( ) ) . ok ( ) . and_then ( | key | key . query_str ( " " ) . ok ( ) ) . map ( | path | PathBuf :: from ( path ) . join ( tool ) ) . and_then ( | path | if path . is_file ( ) { Some ( path ) } else { None } ) ; } path . map ( | path | { let mut tool = Tool :: with_family ( path , MSVC_FAMILY ) ; if target . contains ( " " ) { tool . env . push ( ( " " . into ( ) , " " . into ( ) ) ) ; } if target . contains ( " " ) { tool . env . push ( ( " " . into ( ) , " " . into ( ) ) ) ; } tool } ) }
While the paths to Visual Studio 2017's devenv and MSBuild could
potentially be retrieved from the registry, finding them via
SetupConfiguration has shown to be [more reliable], and is preferred
according to Microsoft.
While the paths to Visual Studio 2017 ' s devenv and MSBuild could potentially be retrieved from the registry finding them via SetupConfiguration has shown to be [ more reliable ] and is preferred according to Microsoft .
tool
&str
target
&str
tool
&str
target
&str