Function: package--list-loaded-files

package--list-loaded-files is a byte-compiled function defined in package.el.gz.

Signature

(package--list-loaded-files DIR)

Documentation

Recursively list all files in DIR which correspond to loaded features.

Returns the file-name-sans-extension of each file, relative to DIR, sorted by most recently loaded last.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
(defun package--list-loaded-files (dir)
  "Recursively list all files in DIR which correspond to loaded features.
Returns the `file-name-sans-extension' of each file, relative to
DIR, sorted by most recently loaded last."
  (let* ((history (package--files-load-history))
         (dir (file-truename dir))
         ;; List all files that have already been loaded.
         (list-of-conflicts (package--list-of-conflicts dir history)))
    ;; Turn the list of (FILENAME . POS) back into a list of features.  Files in
    ;; subdirectories are returned relative to DIR (so not actually features).
    (let ((default-directory (file-name-as-directory dir)))
      (mapcar (lambda (x) (file-truename (car x)))
              (sort list-of-conflicts
                    ;; Sort the files by ascending HISTORY-POSITION.
                    (lambda (x y) (< (cdr x) (cdr y))))))))