Function: files--splice-dirname-file

files--splice-dirname-file is a byte-compiled function defined in files.el.gz.

Signature

(files--splice-dirname-file DIRNAME FILE)

Documentation

Splice DIRNAME to FILE like the operating system would.

If FILE is relative, return DIRNAME concatenated to FILE. Otherwise return FILE, quoted as needed if DIRNAME and FILE have different file name handlers; although this quoting is dubious if DIRNAME is magic, it is not clear what would be better. This function differs from expand-file-name in that DIRNAME must be a directory name and leading ~ and /: are not special in FILE.

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun files--splice-dirname-file (dirname file)
  "Splice DIRNAME to FILE like the operating system would.
If FILE is relative, return DIRNAME concatenated to FILE.
Otherwise return FILE, quoted as needed if DIRNAME and FILE have
different file name handlers; although this quoting is dubious if
DIRNAME is magic, it is not clear what would be better.  This
function differs from `expand-file-name' in that DIRNAME must be
a directory name and leading `~' and `/:' are not special in
FILE."
  (let ((unquoted (if (files--name-absolute-system-p file)
		      file
		    (concat dirname file))))
    (if (eq (find-file-name-handler dirname 'file-symlink-p)
	    (find-file-name-handler unquoted 'file-symlink-p))
	unquoted
      (let (file-name-handler-alist) (file-name-quote unquoted)))))