|
@@ -16,16 +16,16 @@ lexically bound to the current subclass."
|
16
|
16
|
(loop for ,var in ,klasses do ,@body)))))
|
17
|
17
|
|
18
|
18
|
(defmacro do-files ((var path &optional extension) &body body)
|
19
|
|
- "For each file on PATH, run BODY. If EXTENSION is provided, only run BODY
|
20
|
|
-on files that match the given extension."
|
21
|
|
- (alexandria:with-gensyms (extension-p files)
|
|
19
|
+ "For each file under PATH, run BODY. If EXTENSION is provided, only run
|
|
20
|
+BODY on files that match the given extension."
|
|
21
|
+ (alexandria:with-gensyms (extension-p)
|
22
|
22
|
`(flet ((,extension-p (file)
|
23
|
23
|
(string= (pathname-type file) ,extension)))
|
24
|
|
- (let ((,files (cl-fad:list-directory ,path)))
|
25
|
|
- (dolist (,var ,(if extension
|
26
|
|
- `(remove-if-not #',extension-p ,files)
|
27
|
|
- files))
|
28
|
|
- ,@body)))))
|
|
24
|
+ (cl-fad:walk-directory ,path (lambda (,var) ,@body)
|
|
25
|
+ :follow-symlinks nil
|
|
26
|
+ :test (if ,extension
|
|
27
|
+ #',extension-p
|
|
28
|
+ (constantly t))))))
|
29
|
29
|
|
30
|
30
|
(defmacro with-current-directory (path &body body)
|
31
|
31
|
"Change the current directory to PATH and execute BODY in
|