pub fn find_msvc_environment(target: &str, tool: &str) -> Option<Tool> {
        // Early return if the environment doesn't contain a VC install.
        if env::var_os("VCINSTALLDIR").is_none() {
            return None;
        }
        let vs_install_dir = env::var_os("VSINSTALLDIR")?.into();

        // If the vscmd target differs from the requested target then
        // attempt to get the tool using the VS install directory.
        if is_vscmd_target(target) == Some(false) {
            // We will only get here with versions 15+.
            tool_from_vs15plus_instance(tool, target, &vs_install_dir)
        } else {
            // Fallback to simply using the current environment.
            env::var_os("PATH")
                .and_then(|path| {
                    env::split_paths(&path)
                        .map(|p| p.join(tool))
                        .find(|p| p.exists())
                })
                .map(|path| Tool::with_family(path.into(), MSVC_FAMILY))
        }
    }
/// Attempt to find the tool using environment variables set by vcvars.
Attempt to find the tool using environment variables set by vcvars.
Attempt to find the tool using environment variables set by vcvars .
pub fn find_msvc_environment(target: &str, tool: &str) -> Option<Tool> {
        // Early return if the environment doesn't contain a VC install.
        if env::var_os("VCINSTALLDIR").is_none() {
            return None;
        }
        let vs_install_dir = env::var_os("VSINSTALLDIR")?.into();
        // If the vscmd target differs from the requested target then
        // attempt to get the tool using the VS install directory.
        if is_vscmd_target(target) == Some(false) {
            // We will only get here with versions 15+.
            tool_from_vs15plus_instance(tool, target, &vs_install_dir)
        } else {
            // Fallback to simply using the current environment.
            env::var_os("PATH")
                .and_then(|path| {
                    env::split_paths(&path)
                        .map(|p| p.join(tool))
                        .find(|p| p.exists())
                })
                .map(|path| Tool::with_family(path.into(), MSVC_FAMILY))
        }
    }
pub fn find_msvc_environment ( target : & str , tool : & str ) -> Option < Tool > { // Early return if the environment doesn't contain a VC install. if env :: var_os ( " " ) . is_none ( ) { return None ; } let vs_install_dir = env :: var_os ( " " ) ? . into ( ) ; // If the vscmd target differs from the requested target then // attempt to get the tool using the VS install directory. if is_vscmd_target ( target ) == Some ( false ) { // We will only get here with versions 15+. tool_from_vs15plus_instance ( tool , target , & vs_install_dir ) } else { // Fallback to simply using the current environment. env :: var_os ( " " ) . and_then ( | path | { env :: split_paths ( & path ) . map ( | p | p . join ( tool ) ) . find ( | p | p . exists ( ) ) } ) . map ( | path | Tool :: with_family ( path . into ( ) , MSVC_FAMILY ) ) } }
Attempt to find the tool using environment variables set by vcvars.
Attempt to find the tool using environment variables set by vcvars .
target
&str
tool
&str
target
&str
tool
&str