Fall back on pkgutil when mdls cannot determine XQuartz version
This commit is contained in:
parent
d355227036
commit
34623b4ef1
@ -11,8 +11,8 @@ module MacOS::XQuartz extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def detect_version
|
def detect_version
|
||||||
if (path = bundle_path) && path.exist?
|
if (path = bundle_path) && path.exist? && (version = version_from_mdls(path))
|
||||||
version_from_mdls(path)
|
version
|
||||||
elsif prefix.to_s == "/usr/X11"
|
elsif prefix.to_s == "/usr/X11"
|
||||||
guess_system_version
|
guess_system_version
|
||||||
else
|
else
|
||||||
@ -29,7 +29,8 @@ module MacOS::XQuartz extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def version_from_mdls(path)
|
def version_from_mdls(path)
|
||||||
`mdls -raw -name kMDItemVersion "#{path}" 2>/dev/null`.strip
|
version = `mdls -raw -nullMarker "" -name kMDItemVersion "#{path}" 2>/dev/null`.strip
|
||||||
|
version unless version.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
# The XQuartz that Apple shipped in OS X through 10.7 does not have a
|
# The XQuartz that Apple shipped in OS X through 10.7 does not have a
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user