Index: sdk/lib/_internal/pub_generated/lib/src/source/path.dart |
diff --git a/sdk/lib/_internal/pub_generated/lib/src/source/path.dart b/sdk/lib/_internal/pub_generated/lib/src/source/path.dart |
index dc1e8028b7b8a6599e2fa3031a233ef218838a8f..d6f7b8c0c70a9ce04e576216835edb1cc805533e 100644 |
--- a/sdk/lib/_internal/pub_generated/lib/src/source/path.dart |
+++ b/sdk/lib/_internal/pub_generated/lib/src/source/path.dart |
@@ -97,10 +97,14 @@ class PathSource extends Source { |
// Resolve the path relative to the containing file path, and remember |
// whether the original path was relative or absolute. |
var isRelative = p.isRelative(description); |
- if (p.isRelative(description)) { |
- // Can't handle relative paths coming from pubspecs that are not on the |
- // local file system. |
- assert(containingPath != null); |
+ if (isRelative) { |
+ // Relative paths coming from pubspecs that are not on the local file |
+ // system aren't allowed. This can happen if a hosted or git dependency |
+ // has a path dependency. |
+ if (containingPath == null) { |
+ throw new FormatException( |
+ '"$description" is a relative path, but this ' 'isn\'t a local pubspec.'); |
+ } |
description = p.normalize(p.join(p.dirname(containingPath), description)); |
} |