| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * Resolve the [containedUri] against [baseUri] using Dart rules. |
| 7 * |
| 8 * This function behaves similarly to [Uri.resolveUri], except that it properly |
| 9 * handles situations like the following: |
| 10 * |
| 11 * resolveRelativeUri(dart:core, bool.dart) -> dart:core/bool.dart |
| 12 * resolveRelativeUri(package:a/b.dart, ../c.dart) -> package:a/c.dart |
| 13 */ |
| 14 Uri resolveRelativeUri(Uri baseUri, Uri containedUri) { |
| 15 if (containedUri.isAbsolute) { |
| 16 return containedUri; |
| 17 } |
| 18 String scheme = baseUri.scheme; |
| 19 // dart:core => dart:core/core.dart |
| 20 if (scheme == 'dart') { |
| 21 String part = baseUri.path; |
| 22 if (part.indexOf('/') < 0) { |
| 23 baseUri = Uri.parse('$scheme:$part/$part.dart'); |
| 24 } |
| 25 } |
| 26 return baseUri.resolveUri(containedUri); |
| 27 } |
| OLD | NEW |