Function: parse-colon-path
parse-colon-path is a byte-compiled function defined in files.el.gz.
Signature
(parse-colon-path SEARCH-PATH)
Documentation
Explode a search path into a list of directory names.
Directories are separated by path-separator(var)/path-separator(fun) (which is colon in
GNU and Unix systems). Substitute environment variables into the
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.
Source Code
;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun parse-colon-path (search-path)
"Explode a search path into a list of directory names.
Directories are separated by `path-separator' (which is colon in
GNU and Unix systems). Substitute environment variables into the
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."
(declare (ftype (function (string) list)))
(when (stringp 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 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)))))