| Index: lib/packages_file.dart
|
| diff --git a/lib/packages_file.dart b/lib/packages_file.dart
|
| index 73e6061c9f6faf12a74e54123b13aa924cecfc8c..25d2d6883bb29ad774192cf37bf42e9443dd64ea 100644
|
| --- a/lib/packages_file.dart
|
| +++ b/lib/packages_file.dart
|
| @@ -80,6 +80,9 @@ Map<String, Uri> parse(List<int> source, Uri baseLocation) {
|
| ///
|
| /// If [baseUri] is provided, package locations will be made relative
|
| /// to the base URI, if possible, before writing.
|
| +///
|
| +/// All the keys of [packageMapping] must be valid package names,
|
| +/// and the values must be URIs that do not have the `package:` scheme.
|
| void write(StringSink output, Map<String, Uri> packageMapping,
|
| {Uri baseUri, String comment}) {
|
| if (baseUri != null && !baseUri.isAbsolute) {
|
| @@ -104,6 +107,10 @@ void write(StringSink output, Map<String, Uri> packageMapping,
|
| if (!isValidPackageName(packageName)) {
|
| throw new ArgumentError('"$packageName" is not a valid package name');
|
| }
|
| + if (uri.scheme == "package") {
|
| + throw new ArgumentError.value(
|
| + "Package location must not be a package: URI", uri);
|
| + }
|
| output.write(packageName);
|
| output.write(':');
|
| // If baseUri provided, make uri relative.
|
|
|