Function: tramp-adb-handle-file-name-all-completions

tramp-adb-handle-file-name-all-completions is a byte-compiled function defined in tramp-adb.el.gz.

Signature

(tramp-adb-handle-file-name-all-completions FILENAME DIRECTORY)

Documentation

Like file-name-all-completions for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-adb.el.gz
(defun tramp-adb-handle-file-name-all-completions (filename directory)
  "Like `file-name-all-completions' for Tramp files."
  (all-completions
   filename
   (with-parsed-tramp-file-name (expand-file-name directory) nil
     (with-tramp-file-property v localname "file-name-all-completions"
       (tramp-adb-send-command
	v (format "%s -a %s"
		  (tramp-adb-get-ls-command v)
		  (tramp-shell-quote-argument localname)))
       (mapcar
	(lambda (f)
	  (if (file-directory-p (expand-file-name f directory))
	      (file-name-as-directory f)
	    f))
	(with-current-buffer (tramp-get-buffer v)
	  (delete-dups
	   (append
	    ;; In older Android versions, "." and ".." are not
	    ;; included.  In newer versions (toybox, since Android 6)
	    ;; they are.  We fix this by `delete-dups'.
	    '("." "..")
	    (delq
	     nil
	     (mapcar
	      (lambda (l) (and (not (string-match-p "^[[:space:]]*$" l)) l))
	      (split-string (buffer-string) "\n")))))))))))