find-file-in-directories ( directories quot: ( ... name -- ... ? ) -- path'/f ) (original) (raw)

find-file-in-directories ( directories quot: ( ... name -- ... ? ) -- path'/f )
Factor handbook » Input and output » Directory manipulation » Searching directories

Prev: find-files ( path quot: ( ... name -- ... ? ) -- paths )
Next: find-files-in-directories ( directories quot: ( ... name -- ... ? ) -- paths/f )

Vocabulary
io.directories

Inputs

directories a sequence of pathnames
quot a quotation

Outputs

path'/f pathname string or f

Word description
Finds the first file in the input directories matching the predicate quotation, in a breadth-first or depth-first traversal-method.

See also
find-file, find-files, find-files-in-directories

Definition

USING: kernel sequences ;

IN: io.directories

: find-file-in-directories
( directories quot: ( ... name -- ... ? ) -- path'/f )
[ ensure-sequence-of-directories ] dip [ find-file ] curry
map-find drop ; inline