Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1481)

Unified Diff: packages/glob/lib/glob.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/glob/README.md ('k') | packages/glob/lib/src/ast.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/glob/lib/glob.dart
diff --git a/packages/glob/lib/glob.dart b/packages/glob/lib/glob.dart
index 2d2a83f6a9b3a0d4e0b5034d18c19f476e7b2e55..ca83969009ec467b1c7815ed35821ec1e149e19e 100644
--- a/packages/glob/lib/glob.dart
+++ b/packages/glob/lib/glob.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library glob;
-
import 'dart:async';
import 'dart:io';
@@ -45,6 +43,9 @@ class Glob implements Pattern {
/// contained within a directory that matches.
final bool recursive;
+ /// Whether the glob matches paths case-sensitively.
+ bool get caseSensitive => _ast.caseSensitive;
+
/// The parsed AST of the glob.
final AstNode _ast;
@@ -87,21 +88,24 @@ class Glob implements Pattern {
/// Paths matched against the glob are interpreted according to [context]. It
/// defaults to the system context.
///
- /// If [recursive] is true, this glob will match and list not only the files
- /// and directories it explicitly lists, but anything beneath those as well.
- Glob(String pattern, {p.Context context, bool recursive: false})
- : this._(
- pattern,
- context == null ? p.context : context,
- recursive);
-
- // Internal constructor used to fake local variables for [context] and [ast].
- Glob._(String pattern, p.Context context, bool recursive)
- : pattern = pattern,
- context = context,
- recursive = recursive,
- _ast = new Parser(pattern + (recursive ? "{,/**}" : ""), context)
- .parse();
+ /// 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.
+ 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 = new Parser(pattern, context, caseSensitive: caseSensitive);
+ return new Glob._(pattern, context, parser.parse(), recursive);
+ }
+
+ Glob._(this.pattern, this.context, this._ast, this.recursive);
/// Lists all [FileSystemEntity]s beneath [root] that match the glob.
///
« no previous file with comments | « packages/glob/README.md ('k') | packages/glob/lib/src/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698