Function: tramp-sudoedit-handle-make-directory

tramp-sudoedit-handle-make-directory is a byte-compiled function defined in tramp-sudoedit.el.gz.

Signature

(tramp-sudoedit-handle-make-directory DIR &optional PARENTS)

Documentation

Like make-directory for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sudoedit.el.gz
(defun tramp-sudoedit-handle-make-directory (dir &optional parents)
  "Like `make-directory' for Tramp files."
  (setq dir (expand-file-name dir))
  (with-parsed-tramp-file-name dir nil
    (when (and (null parents) (file-exists-p dir))
      (tramp-error v 'file-already-exists "Directory already exists %s" dir))
    ;; When PARENTS is non-nil, DIR could be a chain of non-existent
    ;; directories a/b/c/...  Instead of checking, we simply flush the
    ;; whole cache.
    (tramp-flush-directory-properties
     v (if parents "/" (file-name-directory localname)))
    (unless (tramp-sudoedit-send-command
	     v (if parents '("mkdir" "-p") "mkdir")
	     "-m" (format "%#o" (default-file-modes))
	     (tramp-compat-file-name-unquote localname))
      (tramp-error v 'file-error "Couldn't make directory %s" dir))))