Skip to content

Commit

Permalink
Prefer /Applications/Xcode.app to xcode-select path
Browse files Browse the repository at this point in the history
Mimics VSmac behavior.

Fixes microsoft#249.
  • Loading branch information
sandyarmstrong committed May 11, 2018
1 parent 89dfe29 commit 59e1276
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Clients/Xamarin.Interactive.MTouch/MTouchSdkTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static class MTouchSdkTool
const string XamarinStudioMlaunchPath = "/Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/" +
"AddIns/MonoDevelop.IPhone/mlaunch.app/Contents/MacOS/mlaunch";
const string XamariniOSMlaunchPath = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch";
const string DefaultSdkRoot = "/Applications/Xcode.app/Contents/Developer";

public static readonly Version RequiredMinimumXcodeVersion = new Version (9, 0);

Expand Down Expand Up @@ -68,7 +69,8 @@ static string RunTool (string fileName, string arguments)

public static string GetXcodeSdkRoot ()
{
var sdkRoot = GetXamarinStudioXcodeSdkRoot () ?? GetXcodeSelectXcodeSdkRoot ();
// Mimicking VSmac behavior, xcode-select is checked last
var sdkRoot = GetXamarinStudioXcodeSdkRoot () ?? GetDefaultXCodeSdkRoot () ?? GetXcodeSelectXcodeSdkRoot ();
if (sdkRoot == null)
throw new Exception (Catalog.SharedStrings.XcodeNotFoundMessage);
return sdkRoot;
Expand All @@ -92,6 +94,9 @@ public static Version GetXcodeVersion (string sdkRoot)
}
}

static string GetDefaultXCodeSdkRoot ()
=> Directory.Exists (DefaultSdkRoot) ? DefaultSdkRoot : null;

static string GetXcodeSelectXcodeSdkRoot ()
{
try {
Expand Down

0 comments on commit 59e1276

Please sign in to comment.