Fix agent directory deletion

* lisp/gnus/gnus-agent.el (gnus-agent-expire-unagentized-dirs):
Delete directories in a simpler way that actually works (bug#50986).
This commit is contained in:
Lars Ingebrigtsen 2021-10-03 11:28:27 +02:00
parent b1a8a66fb0
commit b47d7ce1b8

View file

@ -3553,32 +3553,13 @@ articles in every agentized group? "))
(when (and to-remove (when (and to-remove
(or gnus-expert-user (or gnus-expert-user
(gnus-y-or-n-p (gnus-y-or-n-p
"gnus-agent-expire has identified local directories that are\ "gnus-agent-expire has identified local directories that are
not currently required by any agentized group. Do you wish to consider\ not currently required by any agentized group. Do you wish to consider
deleting them?"))) deleting them?")))
(while to-remove (dolist (dir to-remove)
(let ((dir (pop to-remove))) (when (or gnus-expert-user
(if (or gnus-expert-user
(gnus-y-or-n-p (format "Delete %s? " dir))) (gnus-y-or-n-p (format "Delete %s? " dir)))
(let* (delete-recursive (delete-directory dir t)))))))
files f
(delete-recursive
(lambda (f-or-d)
(ignore-errors
(if (file-directory-p f-or-d)
(condition-case nil
(delete-directory f-or-d)
(file-error
(setq files (directory-files f-or-d))
(while files
(setq f (pop files))
(or (member f '("." ".."))
(funcall delete-recursive
(nnheader-concat
f-or-d f))))
(delete-directory f-or-d)))
(delete-file f-or-d))))))
(funcall delete-recursive dir)))))))))
;;;###autoload ;;;###autoload
(defun gnus-agent-batch () (defun gnus-agent-batch ()