sourceFilesBySuffices
lib.sources.sourceFilesBySuffices
Docs pulled from | This Revision | 11 minutes ago
Get all files ending with the specified suffices from the given
source directory or its descendants, omitting files that do not match
any suffix. The result of the example below will include files like
./dir/module.c
and ./dir/subdir/doc.xml
if present.
Inputs
src
-
Path or source containing the files to be returned
exts
-
A list of file suffix strings
Type
sourceLike -> [String] -> Source
Examples
sourceFilesBySuffices
usage example
sourceFilesBySuffices ./. [ ".xml" ".c" ]
Noogle detected
Implementation
The following is the current implementation of this function.
sourceFilesBySuffices =
# Path or source containing the files to be returned
src:
# A list of file suffix strings
exts:
let
filter =
name: type:
let
base = baseNameOf (toString name);
in
type == "directory" || lib.any (ext: lib.hasSuffix ext base) exts;
in
cleanSourceWith { inherit filter src; };