Index: sdk/lib/_internal/pub/lib/src/source/path.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/source/path.dart b/sdk/lib/_internal/pub/lib/src/source/path.dart |
index 9af0fd11e2320dd384e522050023134efde49613..2dfe1520c6b0ae9164ee035a3877175c1eca1338 100644 |
--- a/sdk/lib/_internal/pub/lib/src/source/path.dart |
+++ b/sdk/lib/_internal/pub/lib/src/source/path.dart |
@@ -90,7 +90,8 @@ class PathSource extends Source { |
// local file system. |
assert(containingPath != null); |
- description = path.join(path.dirname(containingPath), description); |
+ description = path.normalize( |
+ path.join(path.dirname(containingPath), description)); |
} |
return { |
@@ -99,6 +100,19 @@ class PathSource extends Source { |
}; |
} |
+ /// Serializes path dependency's [description]. For the descriptions where |
+ /// `relative` attribute is `true`, tries to make `path` relative to the |
+ /// specified [containingPath]. |
+ dynamic serializeDescription(String containingPath, description) { |
+ if (description["relative"]) { |
+ return { |
+ "path": path.relative(description['path'], from: containingPath), |
+ "relative": true |
+ }; |
+ } |
+ return description; |
+ } |
+ |
/// Ensures that [description] is a valid path description and returns a |
/// normalized path to the package. |
/// |
@@ -106,7 +120,7 @@ class PathSource extends Source { |
/// existing directory. Throws an [ApplicationException] if the path is |
/// invalid. |
String _validatePath(String name, description) { |
- var dir = path.normalize(description["path"]); |
+ var dir = description["path"]; |
if (dirExists(dir)) return dir; |