summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 448df62710c..fb09c96c47e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -802,9 +802,15 @@ The path separator is colon in GNU and GNU-like systems."
(setq cd-path (or (parse-colon-path (getenv "CDPATH"))
(list "./"))))
(cd-absolute
- (or (locate-file dir cd-path nil
- (lambda (f) (and (file-directory-p f) 'dir-ok)))
- (error "No such directory found via CDPATH environment variable"))))
+ (or
+ ;; locate-file doesn't support remote file names, so detect them
+ ;; and support them here by hand.
+ (and (file-remote-p (expand-file-name dir))
+ (file-accessible-directory-p (expand-file-name dir))
+ (expand-file-name dir))
+ (locate-file dir cd-path nil
+ (lambda (f) (and (file-directory-p f) 'dir-ok)))
+ (error "No such directory found via CDPATH environment variable"))))
(defun directory-files-recursively (dir regexp &optional include-directories)
"Return list of all files under DIR that have file names matching REGEXP.