Function: tramp-sh-handle-file-writable-p

tramp-sh-handle-file-writable-p is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-sh-handle-file-writable-p FILENAME)

Documentation

Like file-writable-p for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-sh-handle-file-writable-p (filename)
  "Like `file-writable-p' for Tramp files."
  (with-parsed-tramp-file-name (expand-file-name filename) nil
    (with-tramp-file-property v localname "file-writable-p"
      (if (file-exists-p filename)
	  (if (tramp-file-property-p v localname "file-attributes")
	      ;; Examine `file-attributes' cache to see if request can
	      ;; be satisfied without remote operation.
	      (tramp-check-cached-permissions v ?w)
	    (tramp-run-test v "-w" localname))
	;; If file doesn't exist, check if directory is writable.
	(and
	 (file-directory-p (file-name-directory filename))
	 (file-writable-p (file-name-directory filename)))))))