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

Unified Diff: dart/tools/testing/dart/legacy_path.dart

Issue 23568002: Update checked-in binary to 0.6.21.3_r26639 (M6) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | « dart/tools/testing/dart/http_server.dart ('k') | dart/tools/testing/dart/multitest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tools/testing/dart/legacy_path.dart
diff --git a/dart/sdk/lib/io/path_impl.dart b/dart/tools/testing/dart/legacy_path.dart
similarity index 86%
copy from dart/sdk/lib/io/path_impl.dart
copy to dart/tools/testing/dart/legacy_path.dart
index 991586305a6c6eaa4ce0783c94e3d171bb8e7685..73ad68c33192b0cbad67310f2cd6709288ae36be 100644
--- a/dart/sdk/lib/io/path_impl.dart
+++ b/dart/tools/testing/dart/legacy_path.dart
@@ -2,18 +2,18 @@
// 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.
-part of dart.io;
+part of utils;
-class __Path implements _Path {
+class Path {
final String _path;
final bool isWindowsShare;
- __Path(String source)
+ Path(String source)
: _path = _clean(source), isWindowsShare = _isWindowsShare(source);
- __Path.raw(String source) : _path = source, isWindowsShare = false;
+ Path.raw(String source) : _path = source, isWindowsShare = false;
- __Path._internal(String this._path, bool this.isWindowsShare);
+ Path._internal(String this._path, bool this.isWindowsShare);
static String _clean(String source) {
if (Platform.operatingSystem == 'windows') return _cleanWindows(source);
@@ -44,14 +44,14 @@ class __Path implements _Path {
String toString() => _path;
- _Path relativeTo(_Path base) {
+ Path relativeTo(Path base) {
// Returns a path "relative" such that
// base.join(relative) == this.canonicalize.
// Throws exception if an impossible case is reached.
if (base.isAbsolute != isAbsolute ||
base.isWindowsShare != isWindowsShare) {
throw new ArgumentError(
- "Invalid case of _Path.relativeTo(base):\n"
+ "Invalid case of Path.relativeTo(base):\n"
" Path and base must both be relative, or both absolute.\n"
" Arguments: $_path.relativeTo($base)");
}
@@ -71,17 +71,17 @@ class __Path implements _Path {
if(basePath[1] != _path[1]) {
// Replace the drive letter in basePath with that from _path.
basePath = '/${_path[1]}:/${basePath.substring(4)}';
- base = new _Path(basePath);
+ base = new Path(basePath);
}
} else {
throw new ArgumentError(
- "Invalid case of _Path.relativeTo(base):\n"
+ "Invalid case of Path.relativeTo(base):\n"
" Base path and target path are on different Windows drives.\n"
" Arguments: $_path.relativeTo($base)");
}
} else if (baseHasDrive != pathHasDrive) {
throw new ArgumentError(
- "Invalid case of _Path.relativeTo(base):\n"
+ "Invalid case of Path.relativeTo(base):\n"
" Base path must start with a drive letter if and "
"only if target path does.\n"
" Arguments: $_path.relativeTo($base)");
@@ -89,7 +89,7 @@ class __Path implements _Path {
}
if (_path.startsWith(basePath)) {
- if (_path == basePath) return new _Path('.');
+ if (_path == basePath) return new Path('.');
// There must be a '/' at the end of the match, or immediately after.
int matchEnd = basePath.length;
if (_path[matchEnd - 1] == '/' || _path[matchEnd] == '/') {
@@ -97,7 +97,7 @@ class __Path implements _Path {
while (matchEnd < _path.length && _path[matchEnd] == '/') {
matchEnd++;
}
- return new _Path(_path.substring(matchEnd)).canonicalize();
+ return new Path(_path.substring(matchEnd)).canonicalize();
}
}
@@ -118,7 +118,7 @@ class __Path implements _Path {
if (common < baseSegments.length && baseSegments[common] == '..') {
throw new ArgumentError(
- "Invalid case of _Path.relativeTo(base):\n"
+ "Invalid case of Path.relativeTo(base):\n"
" Base path has more '..'s than path does.\n"
" Arguments: $_path.relativeTo($base)");
}
@@ -134,11 +134,11 @@ class __Path implements _Path {
if (hasTrailingSeparator) {
segments.add('');
}
- return new _Path(segments.join('/'));
+ return new Path(segments.join('/'));
}
- _Path join(_Path further) {
+ Path join(Path further) {
if (further.isAbsolute) {
throw new ArgumentError(
"Path.join called with absolute Path as argument.");
@@ -147,17 +147,17 @@ class __Path implements _Path {
return further.canonicalize();
}
if (hasTrailingSeparator) {
- var joined = new __Path._internal('$_path${further}', isWindowsShare);
+ var joined = new Path._internal('$_path${further}', isWindowsShare);
return joined.canonicalize();
}
- var joined = new __Path._internal('$_path/${further}', isWindowsShare);
+ var joined = new Path._internal('$_path/${further}', isWindowsShare);
return joined.canonicalize();
}
// Note: The URI RFC names for canonicalize, join, and relativeTo
// are normalize, resolve, and relativize. But resolve and relativize
// drop the last segment of the base path (the filename), on URIs.
- _Path canonicalize() {
+ Path canonicalize() {
if (isCanonical) return this;
return makeCanonical();
}
@@ -184,7 +184,7 @@ class __Path implements _Path {
return !segs.any((s) => s == '' || s == '.' || s == '..');
}
- _Path makeCanonical() {
+ Path makeCanonical() {
bool isAbs = isAbsolute;
List segs = segments();
String drive;
@@ -242,7 +242,7 @@ class __Path implements _Path {
segmentsToJoin.add('');
}
}
- return new __Path._internal(segmentsToJoin.join('/'), isWindowsShare);
+ return new Path._internal(segmentsToJoin.join('/'), isWindowsShare);
}
String toNativePath() {
@@ -271,13 +271,13 @@ class __Path implements _Path {
return result;
}
- _Path append(String finalSegment) {
+ Path append(String finalSegment) {
if (isEmpty) {
- return new __Path._internal(finalSegment, isWindowsShare);
+ return new Path._internal(finalSegment, isWindowsShare);
} else if (hasTrailingSeparator) {
- return new __Path._internal('$_path$finalSegment', isWindowsShare);
+ return new Path._internal('$_path$finalSegment', isWindowsShare);
} else {
- return new __Path._internal('$_path/$finalSegment', isWindowsShare);
+ return new Path._internal('$_path/$finalSegment', isWindowsShare);
}
}
@@ -294,12 +294,12 @@ class __Path implements _Path {
return (pos < 0) ? '' : name.substring(pos + 1);
}
- _Path get directoryPath {
+ Path get directoryPath {
int pos = _path.lastIndexOf('/');
- if (pos < 0) return new _Path('');
+ if (pos < 0) return new Path('');
while (pos > 0 && _path[pos - 1] == '/') --pos;
var dirPath = (pos > 0) ? _path.substring(0, pos) : '/';
- return new __Path._internal(dirPath, isWindowsShare);
+ return new Path._internal(dirPath, isWindowsShare);
}
String get filename {
« no previous file with comments | « dart/tools/testing/dart/http_server.dart ('k') | dart/tools/testing/dart/multitest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698