ambrevar: Move match-extensions and match-name to `file'.
parent
c1bf82f25d
commit
5feda6addc
|
@ -196,6 +196,25 @@ Without PREDICATES, list all files."
|
|||
(lambda (file)
|
||||
(local-time:timestamp> (modification-date file) timestamp)))
|
||||
|
||||
(export-always 'match-extensions)
|
||||
(defun match-extensions (extension &rest more-extensions)
|
||||
"Return a predicate for files that match on of the provided extensions.
|
||||
Useful for `finder'."
|
||||
(lambda (file)
|
||||
(some (lambda (ext)
|
||||
(string= ext (extension file)))
|
||||
(cons extension more-extensions))))
|
||||
|
||||
(export-always 'match-name)
|
||||
(defun match-name (name &rest more-names)
|
||||
"Return a predicate that matches when one of the names is contained in the
|
||||
file basename.
|
||||
Basename includes the extension. Useful for `finder'."
|
||||
(lambda (file)
|
||||
(some (lambda (name)
|
||||
(str:contains? name (basename file)))
|
||||
(cons name more-names))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defparameter %magic-cookie-mime nil
|
||||
"Internal storage for `magic-cookie-mime'.")
|
||||
|
|
|
@ -29,25 +29,6 @@
|
|||
(delete-if #'sera:resolve-executable (cons program more-programs))))
|
||||
(error "Missing programs: ~{~a~,^, ~}" missing-programs)))
|
||||
|
||||
(export-always 'match-extensions)
|
||||
(defun match-extensions (extension &rest more-extensions)
|
||||
"Return a predicate for files that match on of the provided extensions.
|
||||
Useful for `finder'."
|
||||
(lambda (file)
|
||||
(some (lambda (ext)
|
||||
(string= ext (pathname-type file)))
|
||||
(cons extension more-extensions))))
|
||||
|
||||
(export-always 'match-name)
|
||||
(defun match-name (name &rest more-names)
|
||||
"Return a predicate that matches when one of the names is contained in the
|
||||
file basename.
|
||||
Basename includes the extension. Useful for `finder'."
|
||||
(lambda (file)
|
||||
(some (lambda (name)
|
||||
(str:contains? name (file-basename file)))
|
||||
(cons name more-names))))
|
||||
|
||||
(export-always 'match-directory)
|
||||
(defun match-directory (&key (empty? t) (non-empty? t) (files? t))
|
||||
"Return a predicate that matches on directories.
|
||||
|
|
Loading…
Reference in New Issue