From f3328f995ee316cffa1a86117e6da2ba299d2c90 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 26 Nov 2018 19:48:37 +0100 Subject: [PATCH] Rework tramp-rclone-mounted-p * lisp/net/tramp-rclone.el (tramp-rclone-mounted-p): Rewrite. (tramp-rclone-maybe-open-connection): Set "mounted" file property. --- lisp/net/tramp-rclone.el | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 725a6f153ad..a1767ab3a16 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -435,15 +435,10 @@ file names." (defun tramp-rclone-mounted-p (vec) "Check, whether storage system determined by VEC is mounted." - (or - ;; We set this property at the end of - ;; `tramp-rclone-maybe-open-connection'. Let's use it as - ;; indicator. - (tramp-get-connection-property vec "uid-integer" nil) - ;; If it is mounted, "." is not shown. If the endpoint is not - ;; connected, `directory-files' returns an error. - (ignore-errors - (not (member "." (directory-files (tramp-rclone-mount-point vec))))))) + (with-tramp-file-property vec "/" "mounted" + (string-match + (format "^%s:" (regexp-quote (tramp-file-name-host vec))) + (shell-command-to-string "mount")))) (defun tramp-rclone-flush-mount (vec) "Flush directory cache of VEC mount." @@ -511,6 +506,7 @@ connection if a previous connection has died for some reason." (tramp-compat-temporary-file-directory))) (apply 'start-process (tramp-get-connection-name vec) buf tramp-rclone-program (delq nil args))))) + (tramp-set-file-property vec "/" "mounted" t) (tramp-message vec 6 "%s" (mapconcat 'identity (process-command p) " ")) (process-put p 'adjust-window-size-function 'ignore)