From e77ab57aae8936929ce61eeccb09f5f07c8925ec Mon Sep 17 00:00:00 2001 From: Peter Atashian Date: Mon, 21 Dec 2015 20:44:48 -0500 Subject: [PATCH] Fix Universal CRT detection on weird setups Checks for a `10.` prefix on the subfolder Signed-off-by: Peter Atashian --- src/librustc_trans/back/msvc/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/librustc_trans/back/msvc/mod.rs b/src/librustc_trans/back/msvc/mod.rs index 3b5b94381b3..6f0baa86579 100644 --- a/src/librustc_trans/back/msvc/mod.rs +++ b/src/librustc_trans/back/msvc/mod.rs @@ -152,8 +152,15 @@ pub fn link_exe_cmd(sess: &Session) -> Command { }).and_then(|root| { fs::read_dir(Path::new(&root).join("Lib")).ok() }).and_then(|readdir| { - let mut dirs: Vec<_> = readdir.filter_map(|dir| dir.ok()) - .map(|dir| dir.path()).collect(); + let mut dirs: Vec<_> = readdir.filter_map(|dir| { + dir.ok() + }).map(|dir| { + dir.path() + }).filter(|dir| { + dir.components().last().and_then(|c| { + c.as_os_str().to_str() + }).map(|c| c.starts_with("10.")).unwrap_or(false) + }).collect(); dirs.sort(); dirs.pop() })