glob-wildcard% ( root globs -- )


Vocabulary
globs.private

Inputs
rootan object
globsan object


Outputs
None

Definition


:: glob-wildcard% ( root globs -- )
globs ?second :> next-glob next-glob dup pair?
[ second ] [ drop f ] if
:> next-glob-regexp root glob-entries [| entry |
root entry name>> append-path {
{ [ next-glob not ] [ dup , ] }
{
[ next-glob empty? ]
[ entry directory? [ dup , ] when ]
}
[
next-glob-regexp [
entry name>> >case-fold next-glob-regexp
matches?
] [ { ~quotation~ ~quotation~ } 0|| ] if [
globs 2 tail
[ dup , ] [
entry directory? ~quotation~ ~quotation~
if
] if-empty
] when
]
} cond { [ entry directory? ] [ next-glob ] } 0&&
[ globs glob% ] [ drop ] if
] each ;