Function: tramp-sh-handle-get-home-directory

tramp-sh-handle-get-home-directory is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-sh-handle-get-home-directory VEC &optional USER)

Documentation

The remote home directory for connection VEC as local file name.

If USER is a string, return its home directory instead of the user identified by VEC. If there is no user specified in either VEC or USER, or if there is no home directory, return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-sh-handle-get-home-directory (vec &optional user)
  "The remote home directory for connection VEC as local file name.
If USER is a string, return its home directory instead of the
user identified by VEC.  If there is no user specified in either
VEC or USER, or if there is no home directory, return nil."
  (when (tramp-send-command-and-check
	 vec (format
	      "echo %s"
	      (tramp-shell-quote-argument
	       (concat "~" (or user (tramp-file-name-user vec))))))
    (with-current-buffer (tramp-get-buffer vec)
      (goto-char (point-min))
      (buffer-substring (point) (line-end-position)))))