]> git.eshelyaron.com Git - emacs.git/commitdiff
Rework tramp-rclone-mounted-p
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 26 Nov 2018 18:48:37 +0000 (19:48 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 26 Nov 2018 18:48:37 +0000 (19:48 +0100)
* lisp/net/tramp-rclone.el (tramp-rclone-mounted-p): Rewrite.
(tramp-rclone-maybe-open-connection): Set "mounted" file property.

lisp/net/tramp-rclone.el

index 725a6f153ad84135b5974a6c4489da1c455a5c76..a1767ab3a162ce8a126db96f7fd82b157664f86c 100644 (file)
@@ -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)