Function: f-join

f-join is a byte-compiled function defined in f.el.

Signature

(f-join &rest ARGS)

Documentation

Join ARGS to a single path.

Be aware if one of the arguments is an absolute path, f-join will discard all the preceeding arguments and make this absolute path the new root of the generated path.

Other relevant functions are documented in the f group.

Shortdoc

;; f
(f-join "path")
    => "path"
  (f-join "path" "to")
    => "path/to"
  (f-join "/" "path" "to" "heaven")
    => "/path/to/heaven"
  (f-join "path" "/to" "file")
    => "/to/file"

Source Code

;; Defined in ~/.emacs.d/elpa/f-20241003.1131/f.el
;;;; Paths

(defun f-join (&rest args)
  "Join ARGS to a single path.

Be aware if one of the arguments is an absolute path, `f-join'
will discard all the preceeding arguments and make this absolute
path the new root of the generated path."
  (let (path
        (relative (f-relative-p (car args))))
    (mapc
     (lambda (arg)
       (setq path (cond ((not path) arg)
                        ((f-absolute-p arg)
                         (progn
                           (setq relative nil)
                           arg))
                        (t (f-expand arg path)))))
     args)
    (if relative (f-relative path) path)))