diff options
| author | Mike McQuaid | 2017-01-09 21:30:32 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2017-01-09 21:10:55 -0800 |
| commit | a17f38dd364af67d5965aaa58438cb768c6d057a (patch) | |
| tree | 3d3e0490cd526150ad6967ef596485bea8e7715e | |
| parent | 2c6915a48fb1456b8075d95735dc2032e23ef210 (diff) | |
| download | brew-a17f38dd364af67d5965aaa58438cb768c6d057a.tar.bz2 | |
xcode: use default location when possible.
Xcode can be installed anywhere but for most people it's in
`/Applications/Xcode.app` so just look there if `xcode-select` isn't
helpful before looking at Spotlight which can return weird results on
e.g. backup disks.
Fixes #1587.
| -rw-r--r-- | Library/Homebrew/os/mac/xcode.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index d13c98b88..e85f21c63 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -3,6 +3,7 @@ module OS module Xcode module_function + DEFAULT_BUNDLE_PATH = Pathname.new("/Applications/Xcode.app").freeze BUNDLE_ID = "com.apple.dt.Xcode".freeze OLD_BUNDLE_ID = "com.apple.Xcode".freeze @@ -67,11 +68,14 @@ module OS Pathname.new("#{prefix}/Toolchains/XcodeDefault.xctoolchain") end - # Ask Spotlight where Xcode is. If the user didn't install the - # helper tools and installed Xcode in a non-conventional place, this - # is our only option. See: https://superuser.com/questions/390757 def bundle_path - MacOS.app_with_bundle_id(V4_BUNDLE_ID, V3_BUNDLE_ID) + # Use the default location if it exists. + return DEFAULT_BUNDLE_PATH if DEFAULT_BUNDLE_PATH.exist? + + # Ask Spotlight where Xcode is. If the user didn't install the + # helper tools and installed Xcode in a non-conventional place, this + # is our only option. See: https://superuser.com/questions/390757 + MacOS.app_with_bundle_id(BUNDLE_ID, OLD_BUNDLE_ID) end def installed? |
