summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2021-08-19 07:48:38 -0500
committerColin Okay <okay@toyful.space>2021-08-19 07:48:38 -0500
commita8563036165449a4663b6e49624ab6b220f775e0 (patch)
tree09b0290c494bbdb640accfa7214b06390706c73b
parent3bf196ab99031366b0fe36c5d75386b59d739424 (diff)
changed the way add-files-matching works
-rw-r--r--flexo.lisp11
1 files 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)))