Function: ghostel--windows-local-path

ghostel--windows-local-path is a natively compiled function defined in ghostel.el.

Signature

(ghostel--windows-local-path PATH)

Documentation

Return PATH in a spelling native Windows Emacs can resolve.

Strips the slash from a slash-drive form ("/d:/foo"), which expand-file-name does not resolve, and rewrites MSYS "/d/foo" and Cygwin "/cygdrive/d/foo" mounts to the existing "d:/foo" directory.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--windows-local-path (path)
  "Return PATH in a spelling native Windows Emacs can resolve.
Strips the slash from a slash-drive form (\"/d:/foo\"), which
`expand-file-name' does not resolve, and rewrites MSYS \"/d/foo\" and
Cygwin \"/cygdrive/d/foo\" mounts to the existing \"d:/foo\" directory."
  (if (string-match-p "\\`/[[:alpha:]]:[/\\]" path)
      (substring path 1)
    (let ((translated
           (and (string-match
                 "\\`\\(?:/cygdrive\\)?/\\([[:alpha:]]\\)\\(/.*\\)?\\'" path)
                (concat (match-string 1 path) ":"
                        (or (match-string 2 path) "/")))))
      (if (and translated (file-directory-p translated))
          translated
        path))))