mirror of
https://github.com/abraunegg/onedrive
synced 2026-03-14 14:35:46 +01:00
added multiGlobMatch()
This commit is contained in:
parent
f5fc13cbad
commit
022ba09e41
1 changed files with 18 additions and 0 deletions
18
src/util.d
18
src/util.d
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue