]> git.lizzy.rs Git - rust.git/commitdiff
Fix Universal CRT detection on weird setups
authorPeter Atashian <retep998@gmail.com>
Tue, 22 Dec 2015 01:44:48 +0000 (20:44 -0500)
committerPeter Atashian <retep998@gmail.com>
Tue, 22 Dec 2015 01:44:48 +0000 (20:44 -0500)
Checks for a `10.` prefix on the subfolder

Signed-off-by: Peter Atashian <retep998@gmail.com>
src/librustc_trans/back/msvc/mod.rs

index 3b5b94381b372f08ab62067c996cf4136206c000..6f0baa86579e02438bfc494457ad03c666eb63e8 100644 (file)
@@ -152,8 +152,15 @@ fn get_ucrt_dir() -> Option<PathBuf> {
         }).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()
         })