Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If Xcode path is not provided, use the xcode path from xcode-select #49

Closed
mandel-macaque opened this issue Apr 20, 2020 · 2 comments
Closed
Labels
apple iOS/tvOS/WatchOS/Mac Catalyst area

Comments

@mandel-macaque
Copy link
Member

If the user does not provide the xcode path, use the path returned by xcode-select.

That means that we have to set the path to be lazy and change the mono options definition from using a '=' to a ':' so that it is an optional parameter.

@premun
Copy link
Member

premun commented Apr 20, 2020

So this happens here already:

static string DetectXcodePath()
{
using var process = new Process();
process.StartInfo.FileName = "xcode-select";
process.StartInfo.Arguments = "-p";
var log = new MemoryLog();
var stdout = new MemoryLog() { Timestamp = false };
var stderr = new ConsoleLog();
var timeout = TimeSpan.FromSeconds(30);
var result = RunAsyncInternal(process, log, stdout, stderr, timeout).GetAwaiter().GetResult();
if (!result.Succeeded)
throw new Exception("Failed to detect Xcode path from xcode-select!");
// Something like /Applications/Xcode114.app/Contents/Developers
var xcodeRoot = stdout.ToString().Trim();
if (string.IsNullOrEmpty(xcodeRoot))
throw new Exception("Failed to detect Xcode path from xcode-select!");
// We need /Applications/Xcode114.app only
return Path.GetDirectoryName(Path.GetDirectoryName(xcodeRoot));
}

@premun premun changed the title [iOS] If Xcode path is not provided, use the xcode path from xcode-select If Xcode path is not provided, use the xcode path from xcode-select Apr 20, 2020
@premun
Copy link
Member

premun commented Apr 20, 2020

I think this is resolved now. Works as expected.

@premun premun closed this as completed Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple iOS/tvOS/WatchOS/Mac Catalyst area
Projects
None yet
Development

No branches or pull requests

2 participants