Skip to content

Commit 9f9afc2

Browse files
committed
Merge pull request dart-archive/package_config#3 from dart-lang/normalize_path
Fixed path normalization (Fix dart-lang/package_config#2).
2 parents f26cd6f + fd35e58 commit 9f9afc2

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

pkgs/package_config/.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
language: dart
2+
dart: dev
23
script: ./tool/travis.sh
34
sudo: false

pkgs/package_config/lib/packagemap.dart

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Packages {
3131
uri, "uri", "Path must not start with '/'.");
3232
}
3333
// Normalizes the path by removing '.' and '..' segments.
34-
uri = _normalizePath(uri);
34+
uri = uri.normalizePath();
3535
String path = uri.path;
3636
var slashIndex = path.indexOf('/');
3737
String packageName;
@@ -51,10 +51,6 @@ class Packages {
5151
return packageLocation.resolveUri(new Uri(path: rest));
5252
}
5353

54-
/// A stand in for uri.normalizePath(), coming in 1.11
55-
static Uri _normalizePath(Uri existingUri) =>
56-
new Uri().resolveUri(existingUri);
57-
5854
/// Parses a `packages.cfg` file into a `Packages` object.
5955
///
6056
/// The [baseLocation] is used as a base URI to resolve all relative
@@ -189,12 +185,12 @@ class Packages {
189185
}
190186
}
191187

192-
baseUri = _normalizePath(baseUri);
188+
baseUri = baseUri.normalizePath();
193189
List<String> base = baseUri.pathSegments.toList();
194190
if (base.isNotEmpty) {
195191
base = new List<String>.from(base)..removeLast();
196192
}
197-
uri = _normalizePath(uri);
193+
uri = uri.normalizePath();
198194
List<String> target = uri.pathSegments.toList();
199195
int index = 0;
200196
while (index < base.length && index < target.length) {

0 commit comments

Comments
 (0)