Function: org-publish-get-base-files
org-publish-get-base-files is a byte-compiled function defined in
ox-publish.el.gz.
Signature
(org-publish-get-base-files PROJECT)
Documentation
Return a list of all files in PROJECT.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-publish.el.gz
(defun org-publish-get-base-files (project)
"Return a list of all files in PROJECT."
(let* ((base-dir (file-name-as-directory
(org-publish-property :base-directory project)))
(extension (or (org-publish-property :base-extension project) "org"))
(match (if (eq extension 'any) ""
(format "^[^\\.].*\\.\\(%s\\)$" extension)))
(base-files
(cond ((not (file-exists-p base-dir)) nil)
((not (org-publish-property :recursive project))
(cl-remove-if #'file-directory-p
(directory-files base-dir t match t)))
(t
;; Find all files recursively. Unlike to
;; `directory-files-recursively', we follow symlinks
;; to other directories.
(letrec ((files nil)
(walk-tree
(lambda (dir depth)
(when (> depth 100)
(error "Apparent cycle of symbolic links for %S"
base-dir))
(dolist (f (file-name-all-completions "" dir))
(pcase f
((or "./" "../") nil)
((pred directory-name-p)
(funcall walk-tree
(expand-file-name f dir)
(1+ depth)))
((pred (string-match match))
(push (expand-file-name f dir) files))
(_ nil)))
files)))
(funcall walk-tree base-dir 0))))))
(org-uniquify
(append
;; Files from BASE-DIR. Apply exclusion filter before adding
;; included files.
(let ((exclude-regexp (org-publish-property :exclude project)))
(if exclude-regexp
(cl-remove-if
(lambda (f)
;; Match against relative names, yet BASE-DIR file
;; names are absolute.
(string-match exclude-regexp
(file-relative-name f base-dir)))
base-files)
base-files))
;; Sitemap file.
(and (org-publish-property :auto-sitemap project)
(list (expand-file-name
(or (org-publish-property :sitemap-filename project)
"sitemap.org")
base-dir)))
;; Included files.
(mapcar (lambda (f) (expand-file-name f base-dir))
(org-publish-property :include project))))))