Function: tramp-rclone-handle-file-system-info

tramp-rclone-handle-file-system-info is a byte-compiled function defined in tramp-rclone.el.gz.

Signature

(tramp-rclone-handle-file-system-info FILENAME)

Documentation

Like file-system-info for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-rclone.el.gz
(defun tramp-rclone-handle-file-system-info (filename)
  "Like `file-system-info' for Tramp files."
  (ignore-errors
    (unless (file-directory-p filename)
      (setq filename (file-name-directory filename)))
    (with-parsed-tramp-file-name (expand-file-name filename) nil
      (tramp-message v 5 "file system info: %s" localname)
      (when (zerop (tramp-rclone-send-command v "about" (concat host ":")))
        (with-current-buffer (tramp-get-connection-buffer v)
	  (let (total used free)
	    (goto-char (point-min))
	    (while (not (eobp))
	      (when (looking-at (rx "Total: " (+ blank) (group (+ digit))))
                (setq total (string-to-number (match-string 1))))
	      (when (looking-at (rx "Used: " (+ blank) (group (+ digit))))
                (setq used (string-to-number (match-string 1))))
	      (when (looking-at (rx "Free: " (+ blank) (group (+ digit))))
                (setq free (string-to-number (match-string 1))))
	      (forward-line))
	    (when used
	      ;; The used number of bytes is not part of the result.
	      ;; As side effect, we store it as file property.
	      (tramp-set-file-property v localname "used-bytes" used))
	    ;; Result.
	    (when (and total free)
	      (list total free (- total free)))))))))