os/mac: ignore apps found in Time Machine backups.

These can introduce confusion on e.g. outdated Xcode versions when they
are the only (or first) versions that are found.
This commit is contained in:
Mike McQuaid 2017-10-05 21:47:26 +01:00
parent 57035b3ba4
commit 4f8af059df

View File

@ -229,7 +229,9 @@ module OS
end
def app_with_bundle_id(*ids)
path = mdfind(*ids).first
path = mdfind(*ids)
.reject { |p| p.include?("/Backups.backupdb/") }
.first
Pathname.new(path) unless path.nil? || path.empty?
end