From df0d4aa8530da406f8e58ee5e6d757acca1045de Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 21 Jul 2013 19:11:04 -0500 Subject: Extract bundle_path from XQuartz.version --- Library/Homebrew/os/mac/xquartz.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew') diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb index a836abcbc..b4fd1ece7 100644 --- a/Library/Homebrew/os/mac/xquartz.rb +++ b/Library/Homebrew/os/mac/xquartz.rb @@ -8,7 +8,7 @@ module MacOS::XQuartz extend self # by this method. def version @version ||= begin - path = MacOS.app_with_bundle_id(FORGE_BUNDLE_ID) || MacOS.app_with_bundle_id(APPLE_BUNDLE_ID) + path = bundle_path if not path.nil? and path.exist? `mdls -raw -name kMDItemVersion "#{path}" 2>/dev/null`.strip elsif prefix.to_s == "/usr/X11" @@ -33,6 +33,10 @@ module MacOS::XQuartz extend self "2.7.4" end + def bundle_path + MacOS.app_with_bundle_id(FORGE_BUNDLE_ID) || MacOS.app_with_bundle_id(APPLE_BUNDLE_ID) + end + def provided_by_apple? [FORGE_BUNDLE_ID, APPLE_BUNDLE_ID].find do |id| MacOS.app_with_bundle_id(id) -- cgit v1.2.3