added multiGlobMatch()

This commit is contained in:
skilion 2016-09-18 11:50:10 +02:00
commit 022ba09e41

View file

@ -89,3 +89,21 @@ bool testNetwork()
return false;
}
}
// call globMatch for each string in pattern separated by '|'
bool multiGlobMatch(const(char)[] path, const(char)[] pattern)
{
foreach (glob; pattern.split('|')) {
if (globMatch!(std.path.CaseSensitive.yes)(path, glob)) {
return true;
}
}
return false;
}
unittest
{
assert(multiGlobMatch(".hidden", ".*"));
assert(multiGlobMatch(".hidden", "file|.*"));
assert(!multiGlobMatch("foo.bar", "foo|bar"));
}