]> git.eshelyaron.com Git - emacs.git/commitdiff
Update standard image-dired thumbnail location
authorMark Oteiza <mvoteiza@udel.edu>
Wed, 14 Dec 2016 19:34:21 +0000 (14:34 -0500)
committerMark Oteiza <mvoteiza@udel.edu>
Wed, 14 Dec 2016 19:34:21 +0000 (14:34 -0500)
* lisp/image-dired.el (image-dired-thumb-name): Conform to the latest
standard: consider XDG_CACHE_HOME, falling back on ~/.cache.

lisp/image-dired.el

index 1c99db333f54ca9408a8e80cddce7b12f05726ee..066a994916683da705ef899981943275518894c7 100644 (file)
@@ -587,9 +587,12 @@ the thumbnail file name unique.  For per-directory storage, just
 add a subdirectory.  For standard storage, produce the file name
 according to the Thumbnail Managing Standard."
   (cond ((eq 'standard image-dired-thumbnail-storage)
-         (expand-file-name
-          (concat "~/.thumbnails/normal/"
-                  (md5 (concat "file://" (expand-file-name file))) ".png")))
+         (let* ((xdg (getenv "XDG_CACHE_HOME"))
+                (dir (if (and xdg (file-name-absolute-p xdg))
+                         xdg "~/.cache")))
+           (expand-file-name
+            (concat (md5 (concat "file://" (expand-file-name file))) ".png")
+            (expand-file-name "thumbnails/normal" dir))))
         ((eq 'use-image-dired-dir image-dired-thumbnail-storage)
          (let* ((f (expand-file-name file))
                 (md5-hash