Function: tramp-smb-handle-file-attributes
tramp-smb-handle-file-attributes is a byte-compiled function defined
in tramp-smb.el.gz.
Signature
(tramp-smb-handle-file-attributes FILENAME &optional ID-FORMAT)
Documentation
Like file-attributes for Tramp files.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-smb.el.gz
(defun tramp-smb-handle-file-attributes (filename &optional id-format)
"Like `file-attributes' for Tramp files."
;; The result is cached in `tramp-convert-file-attributes'.
(setq filename (directory-file-name (expand-file-name filename)))
(with-parsed-tramp-file-name filename nil
(tramp-convert-file-attributes v localname id-format
(ignore-errors
(if (tramp-smb-get-stat-capability v)
(tramp-smb-do-file-attributes-with-stat v)
;; Reading just the filename entry via "dir localname" is
;; not possible, because when filename is a directory, some
;; smbclient versions return the content of the directory,
;; and other versions don't. Therefore, the whole content
;; of the upper directory is retrieved, and the entry of the
;; filename is extracted from.
(let* ((entries (tramp-smb-get-file-entries
(file-name-directory filename)))
(entry (assoc (file-name-nondirectory filename) entries))
(inode (tramp-get-inode v))
(device (tramp-get-device v)))
;; Check result.
(when entry
(list (and (string-search "d" (nth 1 entry)) t) ;0 file type
-1 ;1 link count
(cons
tramp-unknown-id-string tramp-unknown-id-integer) ;2 uid
(cons
tramp-unknown-id-string tramp-unknown-id-integer) ;3 gid
tramp-time-dont-know ;4 atime
(nth 3 entry) ;5 mtime
tramp-time-dont-know ;6 ctime
(nth 2 entry) ;7 size
(nth 1 entry) ;8 mode
nil ;9 gid weird
inode ;10 inode number
device)))))))) ;11 file system number