Function: hpath:resolve

hpath:resolve is a byte-compiled function defined in hpath.el.

Signature

(hpath:resolve PATH)

Documentation

Resolve variables in PATH or prepend path from hpath:auto-variable-alist.

Path variable are prepended from the first PATH matching regexp in hpath:auto-variable-alist. Return any absolute or invalid PATH unchanged.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hpath.el
(defun hpath:resolve (path)
  "Resolve variables in PATH or prepend path from `hpath:auto-variable-alist'.
Path variable are prepended from the first PATH matching regexp
in `hpath:auto-variable-alist'.  Return any absolute or invalid
PATH unchanged."
  (when (stringp path)
    (unless (string-match-p hpath:variable-regexp path)
      (setq path (substitute-in-file-name path)))
    (let (variable-path
	  substituted-path)
      (setq variable-path (hpath:expand-with-variable path)
	    substituted-path (hpath:substitute-value variable-path))
      (cond ((or (null substituted-path) (string-empty-p substituted-path))
	     path)
	    ((and (string-match-p hpath:variable-regexp variable-path)
		  (string-match-p hpath:variable-regexp substituted-path))
	     ;; If a path is invalid, then a variable may have been prepended but
	     ;; it will remain unresolved in `substituted-path', in which case we
	     ;; want to return `path' without any further changes.
	     path)
	    (t substituted-path)))))