From a8563036165449a4663b6e49624ab6b220f775e0 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Thu, 19 Aug 2021 07:48:38 -0500 Subject: changed the way add-files-matching works --- flexo.lisp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/flexo.lisp b/flexo.lisp index e63ba63..e9369c3 100644 --- a/flexo.lisp +++ b/flexo.lisp @@ -395,12 +395,19 @@ artifact tables have changed." :filepath path :keywords keywords)) +(defun sane-file-name (path) + "Returns the string representation of the filename in the pathname + PATH. A sane representation includes the file extension, if present." + (if (pathname-type path) + (format nil "~a.~a" (pathname-name path) (pathname-type path)) + (pathname-name path))) + (defun add-files-matching (directory-path regex class &rest keywords) "Given a root directory and a regular expression REGEX, call ADD-FILE with the supplied CLASS and KEYWORDS for each file - pathname whose namestring is matched by the REGEX." + filename (including extension) whose namestring is matched by the REGEX." (dolist (path (uiop:directory-files directory-path)) - (when (ppcre:scan regex (namestring path)) + (when (ppcre:scan regex (sane-file-name path)) (apply #'add-file path class keywords))) (dolist (subdir (uiop:subdirectories directory-path)) (apply #'add-files-matching subdir regex class keywords))) -- cgit v1.2.3