From b9373ac26ad75fe38638a51eea54944163cc1c38 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 19 Jun 2015 20:47:44 +0300 Subject: [PATCH] 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) --- lisp/files.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/files.el b/lisp/files.el index 4656adac7b0..540d61335cd 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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)) -- 2.39.2