From 94108556ef04fd434c83846701e149b82488c61c Mon Sep 17 00:00:00 2001
From: Forrest Waters <fwaters@anaconda.com>
Date: Tue, 29 Oct 2019 13:51:45 -0500
Subject: [PATCH] remove change that breaks older xcode versions

---
 tools/osx/xcode_locator.m | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/tools/osx/xcode_locator.m b/tools/osx/xcode_locator.m
index 5042c31e34..fff0f2642a 100644
--- a/tools/osx/xcode_locator.m
+++ b/tools/osx/xcode_locator.m
@@ -173,22 +173,6 @@ static void AddEntryToDictionary(XcodeVersionEntry *entry,
     NSLog(@"Version strings for %@: short=%@, expanded=%@",
           url, version, expandedVersion);
 
-    NSURL *versionPlistUrl = [url URLByAppendingPathComponent:@"Contents/version.plist"];
-
-    // macOS 10.13 changed the signature of initWithContentsOfURL,
-    // and deprecated the old one.
-    NSDictionary *versionPlistContents;
-#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_12
-    versionPlistContents = [[NSDictionary alloc] initWithContentsOfURL:versionPlistUrl error:nil];
-#else
-    versionPlistContents = [[NSDictionary alloc] initWithContentsOfURL:versionPlistUrl];
-#endif
-
-    NSString *productVersion = [versionPlistContents objectForKey:@"ProductBuildVersion"];
-    if (productVersion) {
-      expandedVersion = [expandedVersion stringByAppendingFormat:@".%@", productVersion];
-    }
-
     NSURL *developerDir =
         [url URLByAppendingPathComponent:@"Contents/Developer"];
     XcodeVersionEntry *entry =
@@ -267,6 +251,12 @@ int main(int argc, const char * argv[]) {
         versionArg = @"";
       } else {
         versionArg = firstArg;
+        NSCharacterSet *versSet =
+            [NSCharacterSet characterSetWithCharactersInString:@"0123456789."];
+        if ([versionArg rangeOfCharacterFromSet:versSet.invertedSet].length
+            != 0) {
+          versionArg = nil;
+        }
       }
     }
     if (versionArg == nil) {
-- 
2.21.0 (Apple Git-122)

