Function: tramp-gvfs-get-directory-attributes
tramp-gvfs-get-directory-attributes is a byte-compiled function
defined in tramp-gvfs.el.gz.
Signature
(tramp-gvfs-get-directory-attributes DIRECTORY)
Documentation
Return GVFS attributes association list of all files in DIRECTORY.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-gvfs.el.gz
(defun tramp-gvfs-get-directory-attributes (directory)
"Return GVFS attributes association list of all files in DIRECTORY."
;; Don't modify `last-coding-system-used' by accident.
(let ((last-coding-system-used last-coding-system-used)
result)
(with-parsed-tramp-file-name (expand-file-name directory) nil
(with-tramp-file-property v localname "directory-attributes"
(tramp-message v 5 "directory gvfs attributes: %s" localname)
;; Send command.
(tramp-gvfs-send-command
v "gvfs-ls" "-h"
(unless (string-equal (file-remote-p directory 'method) "gdrive") "-n")
"-a" (string-join tramp-gvfs-file-attributes ",")
(tramp-gvfs-url-file-name directory))
;; Parse output.
(with-current-buffer (tramp-get-connection-buffer v)
(goto-char (point-min))
(while (looking-at
(tramp-compat-rx
bol (group (+ nonl)) blank
(group (+ digit)) blank
"(" (group (+? nonl)) ")"
(regexp tramp-gvfs-file-attributes-with-gvfs-ls-regexp)))
(let ((item (list (cons "type" (match-string 3))
(cons "standard::size" (match-string 2))
(cons "name" (match-string 1)))))
(goto-char (1+ (match-end 3)))
(while (looking-at
(tramp-compat-rx
(regexp tramp-gvfs-file-attributes-with-gvfs-ls-regexp)
(group
(| (regexp
tramp-gvfs-file-attributes-with-gvfs-ls-regexp)
eol))))
(push (cons (match-string 1) (match-string 2)) item)
(goto-char (match-end 2)))
;; Add display name as head.
(push
(cons (cdr (or (assoc "standard::display-name" item)
(assoc "name" item)))
(nreverse item))
result))
(forward-line)))
result))))