aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorAdam Vandenberg2012-11-11 11:39:09 -0800
committerAdam Vandenberg2012-11-14 15:10:08 -0800
commit1184584bc2177e44e77ba7470144ba07eaa672bd (patch)
tree62600b0b8b2daee50eabff8f1883fd41e5ea042b /Library/Homebrew
parent0e1580e090f33567e6c3b24456363684fa6fad0e (diff)
downloadhomebrew-1184584bc2177e44e77ba7470144ba07eaa672bd.tar.bz2
Try to remove a single .DS_Store when uninstalling
Closes #12976. Closes #15975.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/extend/pathname.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 0c55e6a6f..d39b21689 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -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