Browse Source

org-persist.el: Do not try to follow XDG on Windows

* lisp/org-persist.el (org-persist-directory): `xdg-cache-home'
apparently returns "~/.cache" even on Windows.  Fallback to
`user-emacs-directory' when the directory returned by `xdg-cache-home'
does not exist.

Reported in https://list.orgmode.org/CAPY3P0RWTkUv_5q0aJjgmpaDGzxYYrs0z4vyEF2Sxpua7BtztA@mail.gmail.com/T/#u
Ihor Radchenko 4 years ago
parent
commit
6621ee32e4
1 changed files with 7 additions and 6 deletions
  1. 7 6
      lisp/org-persist.el

+ 7 - 6
lisp/org-persist.el

@@ -36,12 +36,13 @@
 (declare-function org-at-heading-p "org" (&optional invisible-not-ok))
 
 (defvar org-persist-directory (expand-file-name
-                               (org-file-name-concat
-                                (let ((cache-dir (xdg-cache-home)))
-                                  (if (seq-empty-p cache-dir)
-                                      user-emacs-directory
-                                    cache-dir))
-                                "org-persist/"))
+                    (org-file-name-concat
+                     (let ((cache-dir (xdg-cache-home)))
+                       (if (or (seq-empty-p cache-dir)
+                               (not (file-exists-p cache-dir)))
+                           user-emacs-directory
+                         cache-dir))
+                     "org-persist/"))
   "Directory where the data is stored.")
 
 (defvar org-persist-index-file "index"