static void Init() { SetInvalid(); DeveloperRoot = Environment.GetEnvironmentVariable("MD_APPLE_SDK_ROOT"); if (DeveloperRoot.IsNullOrEmpty) { DeveloperRoot = GetConfiguredSdkLocation(); if (DeveloperRoot.IsNullOrEmpty) { DeveloperRoot = "/Developer"; } } if (!ValidateSdkLocation(DeveloperRoot)) { return; } try { var plist = XcodePath.Combine("Contents", "Info.plist"); if (!File.Exists(plist)) { return; } lastWritten = File.GetLastWriteTime(plist); // DTXCode was introduced after xcode 3.2.6 so it may not exist using (var pool = new NSAutoreleasePool()) { var dict = NSDictionary.FromFile(plist); NSObject value; if (dict.TryGetValue(new NSString("DTXcode"), out value)) { DTXcode = ((NSString)value).ToString(); } } IsXcode4 = !string.IsNullOrEmpty(DTXcode) && int.Parse(DTXcode) >= 0400; IsXcode42 = !string.IsNullOrEmpty(DTXcode) && int.Parse(DTXcode) >= 0420; IsValid = true; } catch (Exception ex) { LoggingService.LogError("Error loading Xcode information for prefix '" + DeveloperRoot + "'", ex); SetInvalid(); } }
static void Init() { SetInvalid(); DeveloperRoot = Environment.GetEnvironmentVariable("MD_APPLE_SDK_ROOT"); if (DeveloperRoot.IsNullOrEmpty) { DeveloperRoot = GetConfiguredSdkLocation(); } bool foundSdk = false; FilePath xcode, vplist, devroot; if (DeveloperRoot.IsNullOrEmpty) { foreach (var v in DefaultRoots) { if (ValidateSdkLocation(v, out xcode, out vplist, out devroot)) { foundSdk = true; break; } else { LoggingService.LogDebug("Apple iOS SDK not found at '{0}'", v); } } } else { foundSdk = ValidateSdkLocation(DeveloperRoot, out xcode, out vplist, out devroot); } if (foundSdk) { XcodePath = xcode; DeveloperRoot = devroot; DeveloperRootVersionPlist = vplist; } else { SetInvalid(); return; } try { var plist = XcodePath.Combine("Contents", "Info.plist"); if (!File.Exists(plist)) { return; } lastWritten = File.GetLastWriteTime(plist); // DTXCode was introduced after xcode 3.2.6 so it may not exist using (var pool = new NSAutoreleasePool()) { var dict = NSDictionary.FromFile(plist); NSObject value; if (dict.TryGetValue(new NSString("DTXcode"), out value)) { DTXcode = ((NSString)value).ToString(); } } IsXcode4 = !string.IsNullOrEmpty(DTXcode) && int.Parse(DTXcode) >= 0400; IsXcode42 = !string.IsNullOrEmpty(DTXcode) && int.Parse(DTXcode) >= 0420; IsValid = true; } catch (Exception ex) { LoggingService.LogError("Error loading Xcode information for prefix '" + DeveloperRoot + "'", ex); SetInvalid(); } }