aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2012-02-17 12:12:05 +0000
committerMax Howell2012-02-17 13:08:55 +0000
commit6caf32a8e5a83eef7ba6ee70d0f53373b09ea219 (patch)
tree5a93439c216b47e622da5b721f0f796b1d24500c /Library
parentfb6aa9df06b1204bcbc5f89edb2edb8742b39ffc (diff)
downloadhomebrew-6caf32a8e5a83eef7ba6ee70d0f53373b09ea219.tar.bz2
Work with Xcode 4.3 if user didn't install helper tools
We ask Spotlight to find Xcode and use that path, neat right?
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/ENV.rb2
-rw-r--r--Library/Homebrew/utils.rb11
2 files changed, 11 insertions, 2 deletions
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 8a599fa81..b059927a6 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -96,7 +96,7 @@ module HomebrewEnvExtension
else
# otherwise lets try and figure it out ourselves
fn = "#{MacOS.dev_tools_path}/#{tool}"
- if File.file? fn
+ if File.executable? fn
fn
else
nil
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 9f7ef663c..bc0f570d9 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -319,7 +319,16 @@ module MacOS extend self
# fallback for broken Xcode 4.3 installs
Pathname.new '/Applications/Xcode.app/Contents/Developer'
else
- nil
+ # 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: http://superuser.com/questions/390757
+ path = `mdfind "kMDItemDisplayName==Xcode&&kMDItemKind==Application"`
+ path = "#{path}/Contents/Developer"
+ if path.empty? or not File.directory? path
+ nil
+ else
+ path
+ end
end
end
end