MacOS: cache calls to mdfind

This commit is contained in:
Jack Nagel 2013-02-04 15:00:10 -06:00
parent 4515803474
commit 7178210a71

View File

@ -230,7 +230,9 @@ module MacOS extend self
end
def mdfind id
`/usr/bin/mdfind "kMDItemCFBundleIdentifier == '#{id}'"`.split("\n")
(@mdfind ||= {}).fetch(id.to_s) do
@mdfind[id.to_s] = `/usr/bin/mdfind "kMDItemCFBundleIdentifier == '#{id}'"`.split("\n")
end
end
def pkgutil_info id