Extract bundle_path from XQuartz.version

This commit is contained in:
Jack Nagel 2013-07-21 19:11:04 -05:00
parent d6ed7fea4a
commit df0d4aa853

View File

@ -8,7 +8,7 @@ module MacOS::XQuartz extend self
# by this method. # by this method.
def version def version
@version ||= begin @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? if not path.nil? and path.exist?
`mdls -raw -name kMDItemVersion "#{path}" 2>/dev/null`.strip `mdls -raw -name kMDItemVersion "#{path}" 2>/dev/null`.strip
elsif prefix.to_s == "/usr/X11" elsif prefix.to_s == "/usr/X11"
@ -33,6 +33,10 @@ module MacOS::XQuartz extend self
"2.7.4" "2.7.4"
end 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? def provided_by_apple?
[FORGE_BUNDLE_ID, APPLE_BUNDLE_ID].find do |id| [FORGE_BUNDLE_ID, APPLE_BUNDLE_ID].find do |id|
MacOS.app_with_bundle_id(id) MacOS.app_with_bundle_id(id)