From 8c093003c4defcc02e21f19ce812b065afecc277 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Tue, 21 Sep 2021 20:25:51 -0700 Subject: find XDG_CACHE_HOME without relying on HOME CONNECTION-CONNATTR for :REMOTE-HOME avoids relying on the HOME environment variable having the correct value; its docstring describes a case in which HOME's value can be incorrect. As determining :XDG-CACHE-HOME depends in most cases on having the correct value for the remote home directory, don't rely on the HOME environment variable here either. Signed-off-by: Sean Whitton --- src/connection.lisp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/connection.lisp') diff --git a/src/connection.lisp b/src/connection.lisp index 8cd3a00..b01f298 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -246,9 +246,11 @@ login(1)). Tilde expansion works correctly." (defmethod connection-connattr ((connection connection) (k (eql :XDG-CACHE-HOME))) - (ensure-directory-pathname - (stripln - (connection-run connection "echo ${XDG_CACHE_HOME:-$HOME/.cache}" nil)))) + (let ((env (stripln (connection-run connection "echo $XDG_CACHE_HOME" nil)))) + (if (plusp (length env)) + (ensure-directory-pathname env) + (merge-pathnames ".cache/" + (connection-connattr connection :remote-home))))) ;;;; Functions to access the slots of the current connection -- cgit v1.2.3