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

Unified Diff: third_party/dart-packages/path/path/src/context.dart

Issue 971083002: Create an apptesting framework for dart. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Update upload_binaries.py to add the apptest.dartzip artifact. Created 5 years, 10 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: third_party/dart-packages/path/path/src/context.dart
diff --git a/sky/tests/resources/third_party/path/src/context.dart b/third_party/dart-packages/path/path/src/context.dart
similarity index 98%
copy from sky/tests/resources/third_party/path/src/context.dart
copy to third_party/dart-packages/path/path/src/context.dart
index a3efd95a9cbd4c4b5829df32149857911d4f1028..c2fe48d0d17b618ff43702302659786ea75a1aee 100644
--- a/sky/tests/resources/third_party/path/src/context.dart
+++ b/third_party/dart-packages/path/path/src/context.dart
@@ -324,7 +324,13 @@ class Context {
/// "/", no path can be determined. In this case, a [PathException] will be
/// thrown.
String relative(String path, {String from}) {
- from = from == null ? current : this.join(current, from);
+ // Avoid calling [current] since it is slow and calling join() when
+ // [from] is absolute does nothing.
+ if (from == null) {
+ from = current;
+ } else if (this.isRelative(from) || this.isRootRelative(from)) {
+ from = this.join(current, from);
+ }
// We can't determine the path from a relative path to an absolute path.
if (this.isRelative(from) && this.isAbsolute(path)) {

Powered by Google App Engine
This is Rietveld 408576698