summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2015-06-19 20:47:44 +0300
committerEli Zaretskii <eliz@gnu.org>2015-06-19 20:47:44 +0300
commitb9373ac26ad75fe38638a51eea54944163cc1c38 (patch)
treebbff33d25afc59cb5df0c3b6ef6d5709c22d3ea4 /lisp/files.el
parentea47568b19e5dc89c48529edfc1ceedee68a5448 (diff)
downloademacs-b9373ac26ad75fe38638a51eea54944163cc1c38.tar.gz
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)
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el7
1 files changed, 6 insertions, 1 deletions
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))