Skip to content
Snippets Groups Projects
Commit 16723afa authored by Jack Nagel's avatar Jack Nagel
Browse files

Only remove DS_Store on ENOTEMPTY

parent bffe090b
No related branches found
No related tags found
No related merge requests found
......@@ -141,14 +141,14 @@ class Pathname
def rmdir_if_possible
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
rescue Errno::ENOTEMPTY
if (ds_store = self+'.DS_Store').exist? && children.length == 1
ds_store.unlink
retry
else
false
end
raise unless e.errno == Errno::ENOTEMPTY::Errno or e.errno == Errno::EACCES::Errno or e.errno == Errno::ENOENT::Errno
rescue Errno::EACCES, Errno::ENOENT
false
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment