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

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

Signature

(tramp-gvfs-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-gvfs.el.gz
(defun tramp-gvfs-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."
  (let ((localname (tramp-get-connection-property vec "default-location"))
	result)
    (cond
     ((tramp-string-empty-or-nil-p localname)
      (tramp-get-connection-property (tramp-get-process vec) "share"))
     ;; Google-drive.
     ((not (string-prefix-p "/" localname))
      (dolist (item
	       (tramp-gvfs-get-directory-attributes
		(tramp-make-tramp-file-name vec "/"))
	       result)
	(when (string-equal (cdr (assoc "name" item)) localname)
	  (setq result (concat "/" (car item))))))
     (t localname))))