aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorCamillo Lugaresi2012-06-06 22:29:52 +0200
committerJack Nagel2012-07-01 12:12:44 -0500
commit65567eb55fc97925b023737456b1e989d48d68f2 (patch)
tree5c09c7d825fb0353354489448a570b743f98e24e /Library
parenta07085df2def6bc25ee0d118e86b10e49c68aab0 (diff)
downloadbrew-65567eb55fc97925b023737456b1e989d48d68f2.tar.bz2
add method to find XQuartz version
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/macos.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb
index 632077dbf..c0d31e6fe 100644
--- a/Library/Homebrew/macos.rb
+++ b/Library/Homebrew/macos.rb
@@ -5,6 +5,8 @@ module MacOS extend self
XCODE_3_BUNDLE_ID = "com.apple.Xcode"
CLT_STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo"
CLT_FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI"
+ APPLE_X11_BUNDLE_ID = "org.x.X11"
+ XQUARTZ_BUNDLE_ID = "org.macosforge.xquartz.X11"
def version
MACOS_VERSION
@@ -313,6 +315,16 @@ module MacOS extend self
end
end
+ def xquartz_version
+ # This returns the version number of XQuartz, not of the upstream X.org
+ # (which is why it is not called x11_version). Note that the X11.app
+ # distributed by Apple is also XQuartz, and therefore covered by this method.
+ path = app_with_bundle_id(XQUARTZ_BUNDLE_ID) or app_with_bundle_id(APPLE_X11_BUNDLE_ID)
+ version = if not path.nil? and path.exist?
+ `mdls -raw -name kMDItemVersion #{path}`.strip
+ end
+ end
+
def x11_prefix
@x11_prefix ||= if Pathname.new('/opt/X11/lib/libpng.dylib').exist?
Pathname.new('/opt/X11')