Function: tramp-sh-handle-file-directory-p

tramp-sh-handle-file-directory-p is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-sh-handle-file-directory-p FILENAME)

Documentation

Like file-directory-p for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
;; Functions implemented using the basic functions above.

(defun tramp-sh-handle-file-directory-p (filename)
  "Like `file-directory-p' for Tramp files."
  (with-parsed-tramp-file-name (expand-file-name filename) nil
    ;; `file-directory-p' is used as predicate for file name completion.
    ;; Sometimes, when a connection is not established yet, it is
    ;; desirable to return t immediately for "/method:foo:".  It can
    ;; be expected that this is always a directory.
    (or (tramp-string-empty-or-nil-p localname)
	(with-tramp-file-property v localname "file-directory-p"
	  (if-let
	      ((truename (tramp-get-file-property v localname "file-truename"))
	       (attr-p (tramp-file-property-p
			v (tramp-file-local-name truename) "file-attributes")))
	      (eq (file-attribute-type
		   (tramp-get-file-property
		    v (tramp-file-local-name truename) "file-attributes"))
		  t)
	    (tramp-run-test v "-d" localname))))))