diff options
author | Eli Zaretskii <eliz@gnu.org> | 2022-08-24 19:19:33 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2022-08-24 19:19:33 +0300 |
commit | 95b1eacd4750da7329380aabcb383a8f9d96a59b (patch) | |
tree | 1ee5aef4ce7372df0232118057a2388ce213d0e2 /lisp | |
parent | 3835255a38dc8c2a37c063fdcb7f3486094893e9 (diff) | |
download | emacs-95b1eacd4750da7329380aabcb383a8f9d96a59b.tar.gz |
Fix handling of UNCs in 'parse-colon-path
* lisp/files.el (parse-colon-path): Don't remove the second
leading slash on systems that support UNCs. (Bug#57353)
* test/lisp/files-tests.el (files-tests-bug-21454): Update
expected results.
(files-colon-path): Add a new test pattern.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/files.el | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lisp/files.el b/lisp/files.el index 8596d9a8390..740e09055bb 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -851,15 +851,20 @@ resulting list of directory names. For an empty path element (i.e., a leading or trailing separator, or two adjacent separators), return nil (meaning `default-directory') as the associated list element." (when (stringp search-path) - (let ((spath (substitute-env-vars search-path))) + (let ((spath (substitute-env-vars search-path)) + (double-slash-special-p + (memq system-type '(windows-nt cygwin ms-dos)))) (mapcar (lambda (f) (if (equal "" f) nil (let ((dir (file-name-as-directory f))) ;; Previous implementation used `substitute-in-file-name' - ;; which collapse multiple "/" in front. Do the same for - ;; backward compatibility. - (if (string-match "\\`/+" dir) - (substring dir (1- (match-end 0))) dir)))) + ;; which collapses multiple "/" in front, while + ;; preserving double slash where it matters. Do + ;; the same for backward compatibility. + (if (string-match "\\`//+" dir) + (substring dir (- (match-end 0) + (if double-slash-special-p 2 1))) + dir)))) (split-string spath path-separator))))) (defun cd-absolute (dir) |