Function: tramp-smb-handle-substitute-in-file-name
tramp-smb-handle-substitute-in-file-name is a byte-compiled function
defined in tramp-smb.el.gz.
Signature
(tramp-smb-handle-substitute-in-file-name FILENAME)
Documentation
Like substitute-in-file-name for Tramp files.
"//" substitutes only in the local filename part. Catches
errors for shares like "C$/", which are common in Microsoft Windows.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-smb.el.gz
(defun tramp-smb-handle-substitute-in-file-name (filename)
"Like `substitute-in-file-name' for Tramp files.
\"//\" substitutes only in the local filename part. Catches
errors for shares like \"C$/\", which are common in Microsoft Windows."
;; Check, whether the local part is a quoted file name.
(if (file-name-quoted-p filename)
filename
(with-parsed-tramp-file-name filename nil
;; Ignore in LOCALNAME everything before "//".
(when (and (stringp localname)
(string-match (rx (+? nonl) "/" (group (| "/" "~"))) localname))
(setq filename
(concat (file-remote-p filename)
(replace-match "\\1" nil nil localname)))))
(condition-case nil
(tramp-run-real-handler #'substitute-in-file-name (list filename))
(error filename))))