glob static method
Returns a list of files which match the specified glob pattern
.
Parameters:
pattern
Glob pattern of file list.
caseSensitive
True, if the pattern is case sensitive; otherwise false.
notify
Function that is called whenever an item is added.
Implementation
static List<String> glob(String pattern,
{bool? caseSensitive, void Function(String path)? notify}) {
pattern = FilePath.expand(pattern);
Directory directory;
if (pathos.isAbsolute(pattern)) {
final parser = GlobParser();
final node = parser.parse(pattern);
final parts = [];
final nodes = node.nodes;
final length = nodes.length;
for (var i = 1; i < length; i++) {
final element = node.nodes[i];
if (element.strict!) {
parts.add(element);
} else {
break;
}
}
final path = nodes.first.source! + parts.join('/');
directory = Directory(path);
} else {
directory = Directory.current;
}
return FileList(directory, pattern,
caseSensitive: caseSensitive, notify: notify);
}