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

Unified Diff: pkg/glob/lib/src/utils.dart

Issue 549633002: Add support for listing to the glob package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't run glob tests on the browser. Created 6 years, 3 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
Index: pkg/glob/lib/src/utils.dart
diff --git a/pkg/glob/lib/src/utils.dart b/pkg/glob/lib/src/utils.dart
index 12952e88151139317a443ca6a25befc148d52330..fdbc49ac8b111501fe310e0d70b5e0624107efdf 100644
--- a/pkg/glob/lib/src/utils.dart
+++ b/pkg/glob/lib/src/utils.dart
@@ -4,6 +4,8 @@
library glob.utils;
+import 'package:path/path.dart' as p;
+
/// A range from [min] to [max], inclusive.
class Range {
/// The minimum value included by the range.
@@ -53,3 +55,11 @@ final _quote = new RegExp(r"[+*?{}|[\]\\().^$-]");
/// expressions backslash-escaped.
String regExpQuote(String contents) =>
contents.replaceAllMapped(_quote, (char) => "\\${char[0]}");
+
+/// Returns [path] with all its separators replaced with forward slashes.
+///
+/// This is useful when converting from Windows paths to globs.
+String separatorToForwardSlash(String path) {
+ if (p.context != p.Style.windows) return path;
+ return path.replaceAll('\\', '/');
+}

Powered by Google App Engine
This is Rietveld 408576698