emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/osm c9d39256e9 1/4: Delete empty tile cache directories


From: ELPA Syncer
Subject: [elpa] externals/osm c9d39256e9 1/4: Delete empty tile cache directories
Date: Sun, 17 Dec 2023 06:58:14 -0500 (EST)

branch: externals/osm
commit c9d39256e9cfccf732d97a954ead88993111dcce
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Delete empty tile cache directories
---
 osm.el | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/osm.el b/osm.el
index 59b731a8ab..2de9d274c0 100644
--- a/osm.el
+++ b/osm.el
@@ -762,17 +762,16 @@ Should be at least 7 days according to the server usage 
policies."
     (run-with-idle-timer
      30 nil
      (lambda ()
-       (dolist (file
-                (ignore-errors
-                  (directory-files-recursively
-                   osm-tile-directory
-                   "\\.\\(?:png\\|jpe?g\\)\\(?:\\.tmp\\)?\\'" nil)))
-         (when (> (float-time
-                   (time-since
-                    (file-attribute-modification-time
-                     (file-attributes file))))
-                  (* 60 60 24 osm-max-age))
-           (delete-file file)))))))
+       (dolist (dir (directory-files osm-tile-directory t "\\`[^.]+\\'" t))
+         (dolist (file (directory-files
+                        dir t "\\.\\(?:png\\|jpe?g\\)\\(?:\\.tmp\\)?\\'" t))
+           (when (> (float-time (time-since
+                                 (file-attribute-modification-time
+                                  (file-attributes file))))
+                    (* 60 60 24 osm-max-age))
+             (delete-file file)))
+         (when (directory-empty-p dir)
+           (ignore-errors (delete-directory dir))))))))
 
 (defun osm--check-libraries ()
   "Check that Emacs is compiled with the necessary libraries."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]