Function: eshell-split-path
eshell-split-path is a byte-compiled function defined in
esh-util.el.gz.
Signature
(eshell-split-path PATH)
Documentation
Split a path into multiple subparts.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-util.el.gz
(defun eshell-split-path (path)
"Split a path into multiple subparts."
(let ((len (length path))
(i 0) (li 0)
parts)
(if (and (eshell-under-windows-p)
(> len 2)
(eq (aref path 0) ?/)
(eq (aref path 1) ?/))
(setq i 2))
(while (< i len)
(if (and (eq (aref path i) ?/)
(not (get-text-property i 'escaped path)))
(setq parts (cons (if (= li i) "/"
(substring path li (1+ i))) parts)
li (1+ i)))
(setq i (1+ i)))
(if (< li i)
(setq parts (cons (substring path li i) parts)))
(if (and (eshell-under-windows-p)
(string-match "\\`[A-Za-z]:\\'" (car (last parts))))
(setcar (last parts) (concat (car (last parts)) "/")))
(nreverse parts)))