Glob constructor

Glob(
  1. String pattern,
  2. {Context context,
  3. bool recursive: false,
  4. bool caseSensitive}
)

Creates a new glob with pattern.

Paths matched against the glob are interpreted according to context. It defaults to the system context.

If recursive is true, this glob matches and lists not only the files and directories it explicitly matches, but anything beneath those as well.

If caseSensitive is true, this glob matches and lists only files whose case matches that of the characters in the glob. Otherwise, it matches regardless of case. This defaults to false when context is Windows and true otherwise.

Implementation

factory Glob(String pattern,
    {p.Context context, bool recursive = false, bool caseSensitive}) {
  context ??= p.context;
  caseSensitive ??= context.style == p.Style.windows ? false : true;
  if (recursive) pattern += "{,/**}";

  var parser = Parser(pattern, context, caseSensitive: caseSensitive);
  return Glob._(pattern, context, parser.parse(), recursive);
}