summaryrefslogtreecommitdiff
path: root/flexo.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'flexo.lisp')
-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)))