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

Unified Diff: pkg/path/lib/src/style/posix.dart

Issue 309803003: Avoid using RegExps in path to work around issue 19090. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/path/lib/src/style/posix.dart
diff --git a/pkg/path/lib/src/style/posix.dart b/pkg/path/lib/src/style/posix.dart
index e0b601743c743b829aa817fc5721e3128cadb9a9..8067fad74a4ccddb3631ae16b007061568269a13 100644
--- a/pkg/path/lib/src/style/posix.dart
+++ b/pkg/path/lib/src/style/posix.dart
@@ -13,9 +13,24 @@ class PosixStyle extends InternalStyle {
final name = 'posix';
final separator = '/';
+ final separators = const ['/'];
+
+ // Deprecated properties.
+
final separatorPattern = new RegExp(r'/');
final needsSeparatorPattern = new RegExp(r'[^/]$');
final rootPattern = new RegExp(r'^/');
+ final relativeRootPattern = null;
+
+ bool needsSeparator(String path) =>
+ !path.isEmpty && path.codeUnitAt(path.length - 1) != 0x2f; // "/"
Bob Nystrom 2014/06/02 22:43:05 !path.isEmpty -> path.isNotEmpty and elsewhere.
nweiz 2014/06/02 23:13:25 Done.
+
+ String getRoot(String path) {
+ if (!path.isEmpty && path.codeUnitAt(0) == 0x2f) return '/';
+ return null;
+ }
+
+ String getRelativeRoot(String path) => null;
String pathFromUri(Uri uri) {
if (uri.scheme == '' || uri.scheme == 'file') {

Powered by Google App Engine
This is Rietveld 408576698