Try to remove a single .DS_Store when uninstalling

Closes Homebrew/homebrew#12976.
Closes Homebrew/homebrew#15975.
This commit is contained in:
Adam Vandenberg 2012-11-11 11:39:09 -08:00
parent 14cb8c8fce
commit aecd342a2b

View File

@ -145,6 +145,12 @@ class Pathname
rmdir
true
rescue SystemCallError => e
# OK, maybe there was only a single `.DS_Store` file in that folder
if (self/'.DS_Store').exist? && self.children.length == 1
(self/'.DS_Store').unlink
retry
end
raise unless e.errno == Errno::ENOTEMPTY::Errno or e.errno == Errno::EACCES::Errno or e.errno == Errno::ENOENT::Errno
false
end