From 43108e42d95a892cc5e9227c32eaa1174588891e Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 21 Dec 2012 12:55:38 -0600 Subject: [PATCH] Make "XQuartz is installed" heurstic stricter --- Library/Homebrew/macos/xquartz.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/macos/xquartz.rb b/Library/Homebrew/macos/xquartz.rb index 6e64901fca..670f16e37a 100644 --- a/Library/Homebrew/macos/xquartz.rb +++ b/Library/Homebrew/macos/xquartz.rb @@ -6,9 +6,11 @@ module MacOS::XQuartz extend self # The X11.app distributed by Apple is also XQuartz, and therefore covered # by this method. def version - path = MacOS.app_with_bundle_id(FORGE_BUNDLE_ID) || MacOS.app_with_bundle_id(APPLE_BUNDLE_ID) - version = if not path.nil? and path.exist? - `mdls -raw -name kMDItemVersion "#{path}" 2>/dev/null`.strip + @version ||= begin + path = MacOS.app_with_bundle_id(FORGE_BUNDLE_ID) || MacOS.app_with_bundle_id(APPLE_BUNDLE_ID) + if not path.nil? and path.exist? + `mdls -raw -name kMDItemVersion "#{path}" 2>/dev/null`.strip + end end end @@ -34,7 +36,7 @@ module MacOS::XQuartz extend self end def installed? - not prefix.nil? + !version.nil? && !prefix.nil? end end