Function: tramp-drop-volume-letter

tramp-drop-volume-letter is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-drop-volume-letter NAME)

Documentation

Cut off unnecessary drive letter from file NAME.

The functions tramp-*-handle-expand-file-name call expand-file-name locally on a remote file name. When the local system is a W32 system but the remote system is Unix, this introduces a superfluous drive letter into the file name. This function removes it.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-drop-volume-letter (name)
  "Cut off unnecessary drive letter from file NAME.
The functions `tramp-*-handle-expand-file-name' call `expand-file-name'
locally on a remote file name.  When the local system is a W32 system
but the remote system is Unix, this introduces a superfluous drive
letter into the file name.  This function removes it."
  (save-match-data
    (let ((quoted (tramp-compat-file-name-quoted-p name 'top))
	  (result (tramp-compat-file-name-unquote name 'top)))
      (setq result
	    (replace-regexp-in-string
	     (tramp-compat-rx (regexp tramp-volume-letter-regexp) "/")
	     "/" result))
      (if quoted (tramp-compat-file-name-quote result 'top) result))))