Function: projectile-dir-files-native

projectile-dir-files-native is a byte-compiled function defined in projectile.el.

Signature

(projectile-dir-files-native DIRECTORY &optional ROOT)

Documentation

Get the files under DIRECTORY using just Emacs Lisp.

ROOT names the project whose ignore rules apply, defaulting to DIRECTORY itself.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
;;; Native Project Indexing
;;
;; This corresponds to `projectile-indexing-method' being set to native.
(defun projectile-dir-files-native (directory &optional root)
  "Get the files under DIRECTORY using just Emacs Lisp.
ROOT names the project whose ignore rules apply, defaulting to
DIRECTORY itself."
  (let ((progress-reporter
         (make-progress-reporter
          (format "Projectile is indexing %s"
                  (propertize directory 'face 'font-lock-keyword-face))))
        ;; The walker returns absolute paths that all share DIRECTORY as a
        ;; literal prefix - `directory-files-and-attributes' expands each
        ;; entry against the expanded directory.  Stripping that prefix with
        ;; a single `substring' is equivalent to `file-relative-name' here
        ;; but avoids its per-file `expand-file-name'/`abbreviate-file-name'
        ;; cost, which otherwise dominates the post-walk step on large trees.
        (prefix-len (length (file-name-as-directory (expand-file-name directory)))))
    ;; we need the files with paths relative to the project root
    (mapcar (lambda (file) (substring file prefix-len))
            (projectile-index-directory directory
                                        (projectile-filtering-patterns
                                         (expand-file-name (or root directory)))
                                        progress-reporter))))