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
This commit is contained in:
Ihor Radchenko 2021-11-01 19:28:16 +08:00
parent d4e1925147
commit 6621ee32e4
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 7 additions and 6 deletions

View File

@ -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"