From 2e7bebb8661dbaf7ed45e74e824b4cf96bba12db Mon Sep 17 00:00:00 2001 From: Harry Terkelsen Date: Thu, 28 May 2015 15:58:43 -0700 Subject: [PATCH] Don't use Uri.directory --- lib/discovery.dart | 4 ++-- lib/packages.dart | 2 +- lib/packages_file.dart | 2 +- lib/src/packages_impl.dart | 6 +++--- pubspec.yaml | 2 +- test/discovery_test.dart | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/discovery.dart b/lib/discovery.dart index 52f208d..f298a0a 100644 --- a/lib/discovery.dart +++ b/lib/discovery.dart @@ -101,7 +101,7 @@ FileSystemEntity _findPackagesFile(String workingDirectory) { /// a `packages/` directory in the same place. /// If that also fails, it starts checking parent directories for a `.packages` /// file, and stops if it finds it. -/// Otherwise it gives up and returns [Pacakges.noPackages]. +/// Otherwise it gives up and returns [Packages.noPackages]. Packages findPackagesFromFile(Uri fileBaseUri) { Uri baseDirectoryUri = fileBaseUri; if (!fileBaseUri.path.endsWith('/')) { @@ -135,7 +135,7 @@ Packages findPackagesFromFile(Uri fileBaseUri) { /// By default, this function only works for `http:` and `https:` URIs. /// To support other schemes, a loader must be provided, which is used to /// try to load the `.packages` file. The loader should return the contents -/// of the requestsed `.packages` file as bytes, which will be assumed to be +/// of the requested `.packages` file as bytes, which will be assumed to be /// UTF-8 encoded. Future findPackagesFromNonFile(Uri nonFileUri, {Future> loader(Uri name)}) { diff --git a/lib/packages.dart b/lib/packages.dart index 8523ecc..3fba062 100644 --- a/lib/packages.dart +++ b/lib/packages.dart @@ -57,7 +57,7 @@ abstract class Packages { /// for the existence of a `.packages` file. If one is found, it is loaded /// just as in the first step. /// * If no file is found before reaching the file system root, - /// the constant [noPacakages] is returned. It's a `Packages` object + /// the constant [noPackages] is returned. It's a `Packages` object /// with no available packages. /// static Future find(Uri baseLocation) => findPackages(baseLocation); diff --git a/lib/packages_file.dart b/lib/packages_file.dart index 03b37b6..2228cb3 100644 --- a/lib/packages_file.dart +++ b/lib/packages_file.dart @@ -10,7 +10,7 @@ import "src/util.dart" show isIdentifier; /// Parses a `.packages` file into a map from package name to base URI. /// /// The [source] is the byte content of a `.packages` file, assumed to be -/// UTF-8 encoded. In practice, all sinficant parts of the file must be ASCII, +/// UTF-8 encoded. In practice, all significant parts of the file must be ASCII, /// so Latin-1 or Windows-1252 encoding will also work fine. /// /// If the file content is available as a string, its [String.codeUnits] can diff --git a/lib/src/packages_impl.dart b/lib/src/packages_impl.dart index 880b9db..645d765 100644 --- a/lib/src/packages_impl.dart +++ b/lib/src/packages_impl.dart @@ -50,9 +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); + static Uri _normalizePath(Uri uri) => new Uri().resolveUri(uri); } /// A [Packages] implementation based on an existing map. @@ -73,7 +73,7 @@ class FilePackagesDirectoryPackages extends _PackagesBase { FilePackagesDirectoryPackages(this._packageDir); Uri _getBase(String packageName) => - new Uri.directory(path.join(_packageDir.path, packageName, '')); + new Uri.file(path.join(_packageDir.path, packageName, '.')); Iterable _listPackageNames() { return _packageDir.listSync() diff --git a/pubspec.yaml b/pubspec.yaml index 20494b9..2a84d20 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: package_config -version: 0.0.2+2 +version: 0.0.2+3 description: Support for working with Package Resolution config files. author: Dart Team homepage: https://github.com/dart-lang/package_config diff --git a/test/discovery_test.dart b/test/discovery_test.dart index 4a88928..16bdd26 100644 --- a/test/discovery_test.dart +++ b/test/discovery_test.dart @@ -215,7 +215,7 @@ void fileTest(String name, tearDown(() { tempDir.deleteSync(recursive: true); }); - test(name, () => fileTest(new Uri.directory(tempDir.path))); + test(name, () => fileTest(new Uri.file(path.join(tempDir.path, ".")))); }); }