Fix file-in-directory-p when the directory is UNC

* lisp/files.el (file-in-directory-p): Support files and
directories that begin with "//".  (Bug#20844)
This commit is contained in:
Eli Zaretskii 2015-06-19 20:47:44 +03:00
parent ea47568b19
commit b9373ac26a

View file

@ -5279,7 +5279,12 @@ Return nil if DIR is not an existing directory."
dir (file-truename dir))
(let ((ls1 (split-string file "/" t))
(ls2 (split-string dir "/" t))
(root (if (string-match "\\`/" file) "/" ""))
(root
(cond
;; A UNC on Windows systems, or a "super-root" on Apollo.
((string-match "\\`//" file) "//")
((string-match "\\`/" file) "/")
(t "")))
(mismatch nil))
(while (and ls1 ls2 (not mismatch))
(if (string-equal (car ls1) (car ls2))