Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
Merge pull request #13 from dart-lang/normalize_rollbacks
Browse files Browse the repository at this point in the history
Normalize rollbacks.
  • Loading branch information
pq committed May 28, 2015
2 parents f26dea9 + 5b43eb3 commit aea975d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/packages_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ Uri _relativize(Uri uri, Uri baseUri) {
}
}

baseUri = baseUri.normalizePath();
baseUri = _normalizePath(baseUri);
List<String> base = baseUri.pathSegments.toList();
if (base.isNotEmpty) {
base = new List<String>.from(base)..removeLast();
}
uri = uri.normalizePath();
uri = _normalizePath(uri);
List<String> target = uri.pathSegments.toList();
int index = 0;
while (index < base.length && index < target.length) {
Expand All @@ -170,3 +170,6 @@ Uri _relativize(Uri uri, Uri baseUri) {
return uri;
}
}

// TODO: inline to uri.normalizePath() when we move to 1.11
Uri _normalizePath(Uri uri) => new Uri().resolveUri(uri);
5 changes: 4 additions & 1 deletion lib/src/packages_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class NoPackages implements Packages {
/// member
abstract class _PackagesBase implements Packages {
Uri resolve(Uri packageUri, {Uri notFound(Uri packageUri)}) {
packageUri = packageUri.normalizePath();
packageUri = _normalizePath(packageUri);
String packageName = checkValidPackageUri(packageUri);
Uri packageBase = _getBase(packageName);
if (packageBase == null) {
Expand All @@ -50,6 +50,9 @@ abstract class _PackagesBase implements Packages {
/// Returns `null` if no package exists with that name, and that can be
/// determined.
Uri _getBase(String packageName);

// TODO: inline to uri.normalizePath() when we move to 1.11
static Uri _normalizePath(Uri uri) => new Uri().resolveUri(uri);
}

/// A [Packages] implementation based on an existing map.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: package_config
version: 0.0.2+1
version: 0.0.2+2
description: Support for working with Package Resolution config files.
author: Dart Team <[email protected]>
homepage: https://github.com/dart-lang/package_config
Expand Down

0 comments on commit aea975d

Please sign in to comment.