Function: hpath:mswindows-to-posix

hpath:mswindows-to-posix is an autoloaded, interactive and byte-compiled function defined in hpath.el.

Signature

(hpath:mswindows-to-posix PATH)

Documentation

Convert a MSWindows PATH to a Posix-style path or return the path unchanged.

If path begins with an MSWindows drive letter, prefix the converted path with the value of hpath:mswindows-mount-prefix.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hpath.el
;;;###autoload
(defun hpath:mswindows-to-posix (path)
  "Convert a MSWindows PATH to a Posix-style path or return the path unchanged.
If path begins with an MSWindows drive letter, prefix the
converted path with the value of `hpath:mswindows-mount-prefix'."
  (interactive "sMSWindows path to convert to POSIX: ")
  (when (and (stringp path) (not (equal path "\\\\")))
    (setq path (hpath:mswindows-to-posix-separators path))
    (when (string-match hpath:mswindows-drive-regexp path)
      (let* ((drive-prefix (downcase (match-string 2 path)))
	     (rest-of-path (substring path (match-end 0)))
	     (absolute-p (and (not (string-empty-p rest-of-path))
			      (= (aref rest-of-path 0) ?/))))
	;; Convert MSWindows disk drive paths to POSIX-style with a mount prefix.
	(setq path (concat hpath:mswindows-mount-prefix drive-prefix
			   (cond (hyperb:microsoft-os-p ":")
				 (absolute-p "")
				 (t "/"))
			   rest-of-path)))))
  path)