From 89325bbb19a0248f2e8d70120fc28322a9947e97 Mon Sep 17 00:00:00 2001 From: Xu Cheng <xucheng@me.com> Date: Fri, 6 Mar 2015 10:39:46 +0800 Subject: [PATCH] cleanup: optimize perfermance Only remove .DS_Store files from whitelisted directories. Closes Homebrew/homebrew#37409. Signed-off-by: Xu Cheng <xucheng@me.com> --- Library/Homebrew/cmd/cleanup.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 74437b0052..8457e75002 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -111,7 +111,10 @@ module Homebrew end def rm_DS_Store - quiet_system "find", HOMEBREW_PREFIX.to_s, "-name", ".DS_Store", "-delete" + paths = %w[Cellar Frameworks Library bin etc include lib opt sbin share var]. + map { |p| HOMEBREW_PREFIX/p }.select(&:exist?) + args = paths.map(&:to_s) + %w[-name .DS_Store -delete] + quiet_system "find", *args end end -- GitLab