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)) { |