]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix remote directories in Eshell on MS-Windows
authorEli Zaretskii <eliz@gnu.org>
Sat, 29 Dec 2018 08:15:50 +0000 (10:15 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 29 Dec 2018 08:15:50 +0000 (10:15 +0200)
* lisp/files.el (cd): Support remote directory names on
MS-Windows.  (Bug#33791)

lisp/files.el

index eb09a7c83f563587f5a10f99239e9ed2bb0dc8af..0b82c943347502bd72d45e083c28bcfa61c7bb46 100644 (file)
@@ -801,9 +801,16 @@ 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-name-absolute-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.