Function: tramp-fuse-mounted-p

tramp-fuse-mounted-p is a byte-compiled function defined in tramp-fuse.el.gz.

Signature

(tramp-fuse-mounted-p VEC)

Documentation

Check, whether fuse volume determined by VEC is mounted.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-fuse.el.gz
(defun tramp-fuse-mounted-p (vec)
  "Check, whether fuse volume determined by VEC is mounted."
  ;; Remember the mount status by using a file property on "/",
  ;; instead of using a connection property, because a file property
  ;; has a timeout.  Having a timeout lets us regularly recheck the
  ;; mount status, as requested by `tramp-fuse-mount-timeout'.  We
  ;; cannot use `with-tramp-file-property', because we don't want to
  ;; cache a nil result.
  (let ((remote-file-name-inhibit-cache tramp-fuse-mount-timeout))
    (or (tramp-get-file-property vec "/" "mounted")
        (let* ((default-directory tramp-compat-temporary-file-directory)
               (command (format "mount -t fuse.%s" (tramp-file-name-method vec)))
	       (mount (shell-command-to-string command))
	       (mount-spec (split-string (tramp-fuse-mount-spec vec) ":" 'omit)))
          (tramp-message vec 6 "%s\n%s" command mount)
	  ;; The mount-spec contains a trailing local file name part,
	  ;; which might not be visible, for example with rclone
	  ;; mounts of type "memory" or "gdrive".  Make it optional.
	  (setq mount-spec
		(if (cdr mount-spec)
		    (rx (literal (car mount-spec))
			":" (? (literal (cadr mount-spec))))
		  (car mount-spec)))
          (tramp-set-file-property
	   vec "/" "mounted"
           (when (string-match
                  (rx bol (group (regexp mount-spec))
		      " on " (group (+ (not blank))) blank)
                  mount)
	     (tramp-set-file-property
	      vec "/" "mount-point" (match-string 2 mount))
             (match-string 1 mount)))))))