Function: projectile--expand-member-globs

projectile--expand-member-globs is a byte-compiled function defined in projectile.el.

Signature

(projectile--expand-member-globs ROOT PATTERNS)

Documentation

Expand PATTERNS relative to ROOT into a list of relative directory names.

PATTERNS are workspace member globs (packages/*, crates/core). Only existing directories survive, and each comes back with a trailing slash. Negated patterns - pnpm allows a leading ! - are dropped rather than subtracted, which can only leave the answer too generous, never too narrow.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--expand-member-globs (root patterns)
  "Expand PATTERNS relative to ROOT into a list of relative directory names.
PATTERNS are workspace member globs (`packages/*', `crates/core').  Only
existing directories survive, and each comes back with a trailing slash.
Negated patterns - pnpm allows a leading `!' - are dropped rather than
subtracted, which can only leave the answer too generous, never too
narrow."
  (let ((default-directory root)
        (dirs nil))
    (dolist (pattern patterns)
      (unless (string-prefix-p "!" pattern)
        ;; Two arguments only: the third is REGEXP, not a dotfile flag, and
        ;; passing it makes a glob be read as a regular expression.
        (dolist (hit (file-expand-wildcards (directory-file-name pattern)))
          (when (file-directory-p (expand-file-name hit root))
            (push (file-name-as-directory hit) dirs)))))
    (sort (delete-dups dirs) #'string<)))