cleanup: only clean cache if it exists.

Closes Homebrew/homebrew#33297.
This commit is contained in:
Mike McQuaid 2014-10-19 12:18:44 +01:00
parent f7bb519041
commit b6c2c8cdc8

View File

@ -75,6 +75,7 @@ module Homebrew
end
def cleanup_cache
return unless HOMEBREW_CACHE.directory?
HOMEBREW_CACHE.children.select(&:file?).each do |file|
next unless (version = file.version)
next unless (name = file.basename.to_s[/(.*)-(?:#{Regexp.escape(version)})/, 1])