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 #14 from hterkelsen/no_directory
Browse files Browse the repository at this point in the history
Don't use Uri.directory
  • Loading branch information
Harry Terkelsen committed May 28, 2015
2 parents aea975d + 2e7bebb commit 866e995
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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('/')) {
Expand Down Expand Up @@ -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<Packages> findPackagesFromNonFile(Uri nonFileUri,
{Future<List<int>> loader(Uri name)}) {
Expand Down
2 changes: 1 addition & 1 deletion lib/packages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Packages> find(Uri baseLocation) => findPackages(baseLocation);
Expand Down
2 changes: 1 addition & 1 deletion lib/packages_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/src/packages_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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<String> _listPackageNames() {
return _packageDir.listSync()
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+2
version: 0.0.2+3
description: Support for working with Package Resolution config files.
author: Dart Team <[email protected]>
homepage: https://github.com/dart-lang/package_config
Expand Down
2 changes: 1 addition & 1 deletion test/discovery_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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, "."))));
});
}

Expand Down

0 comments on commit 866e995

Please sign in to comment.