add method to find XQuartz version

This commit is contained in:
Camillo Lugaresi 2012-06-06 22:29:52 +02:00 committed by Jack Nagel
parent a07085df2d
commit 65567eb55f

View File

@ -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')