From a56a0dadad894228ebff137829349506cf374a68 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sat, 22 Dec 2012 14:24:25 -0600 Subject: [PATCH] Try to find XQuartz via pkgutil if mdls fails c.f. Homebrew/homebrew#16296. --- Library/Homebrew/macos/xquartz.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/macos/xquartz.rb b/Library/Homebrew/macos/xquartz.rb index 670f16e37a..07a5c3d3d0 100644 --- a/Library/Homebrew/macos/xquartz.rb +++ b/Library/Homebrew/macos/xquartz.rb @@ -1,6 +1,7 @@ module MacOS::XQuartz extend self FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11" APPLE_BUNDLE_ID = "org.x.X11" + FORGE_PKG_ID = "org.macosforge.xquartz.pkg" # This returns the version number of XQuartz, not of the upstream X.org. # The X11.app distributed by Apple is also XQuartz, and therefore covered @@ -10,6 +11,9 @@ module MacOS::XQuartz extend self 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 + else + # Some users disable Spotlight indexing. Try to find it via pkgutil + MacOS.pkgutil_info(FORGE_PKG_ID) =~ /version: (\d\.\d\.\d).+$/ and $1 end end end