[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107147: Add extra checks before expi
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107147: Add extra checks before expiring the URL cache |
Date: |
Mon, 06 Feb 2012 22:37:56 +0100 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107147
committer: Lars Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Mon 2012-02-06 22:37:56 +0100
message:
Add extra checks before expiring the URL cache
(url-cache-prune-cache): Check that the directory exists before
trying to delete it.
modified:
lisp/url/ChangeLog
lisp/url/url-cache.el
=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog 2012-02-06 21:06:15 +0000
+++ b/lisp/url/ChangeLog 2012-02-06 21:37:56 +0000
@@ -1,6 +1,8 @@
2012-02-06 Lars Ingebrigtsen <address@hidden>
* url-cache.el (url-cache-prune-cache): New function.
+ (url-cache-prune-cache): Check that the directory exists before
+ trying to delete it.
* url.el (url-retrieve-number-of-calls): New variable.
(url-retrieve-internal): Use it to expire the cache once in a
=== modified file 'lisp/url/url-cache.el'
--- a/lisp/url/url-cache.el 2012-02-06 21:06:15 +0000
+++ b/lisp/url/url-cache.el 2012-02-06 21:37:56 +0000
@@ -216,24 +216,26 @@
(let ((current-time (current-time))
(total-files 0)
(deleted-files 0))
- (dolist (file (directory-files (or directory url-cache-directory) t))
- (unless (member (file-name-nondirectory file) '("." ".."))
- (setq total-files (1+ total-files))
- (cond
- ((file-directory-p file)
- (when (url-cache-prune-cache file)
- (setq deleted-files (1+ deleted-files))))
- ((time-less-p
- (time-add
- (nth 5 (file-attributes file))
- (seconds-to-time url-cache-expire-time))
- current-time)
- (delete-file file)
- (setq deleted-files (1+ deleted-files))))))
- (if (< deleted-files total-files)
- nil
- (delete-directory directory)
- t)))
+ (setq directory (or directory url-cache-directory))
+ (when (file-exists-p directory)
+ (dolist (file (directory-files directory t))
+ (unless (member (file-name-nondirectory file) '("." ".."))
+ (setq total-files (1+ total-files))
+ (cond
+ ((file-directory-p file)
+ (when (url-cache-prune-cache file)
+ (setq deleted-files (1+ deleted-files))))
+ ((time-less-p
+ (time-add
+ (nth 5 (file-attributes file))
+ (seconds-to-time url-cache-expire-time))
+ current-time)
+ (delete-file file)
+ (setq deleted-files (1+ deleted-files))))))
+ (if (< deleted-files total-files)
+ nil
+ (delete-directory directory)
+ t))))
(provide 'url-cache)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107147: Add extra checks before expiring the URL cache,
Lars Ingebrigtsen <=