Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: pkg/analysis_server/lib/src/package_uri_resolver.dart

Issue 341273007: Allow multiple dirs per package in the data returned by "pub list". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/package_uri_resolver.dart
diff --git a/pkg/analysis_server/lib/src/package_uri_resolver.dart b/pkg/analysis_server/lib/src/package_uri_resolver.dart
index 7328652571d0a4ec0bddbc2acdba93a94b2245d5..2aaaca94a8b6415711177fe0307d244578314784 100644
--- a/pkg/analysis_server/lib/src/package_uri_resolver.dart
+++ b/pkg/analysis_server/lib/src/package_uri_resolver.dart
@@ -19,10 +19,10 @@ class PackageMapUriResolver extends UriResolver {
static const String PACKAGE_SCHEME = "package";
/**
- * A table mapping package names to the path of the directory containing
+ * A table mapping package names to the path of the directories containing
* the package.
*/
- final Map<String, Folder> packageMap;
+ final Map<String, List<Folder>> packageMap;
/**
* The [ResourceProvider] for this resolver.
@@ -32,8 +32,8 @@ class PackageMapUriResolver extends UriResolver {
/**
* Create a new [PackageMapUriResolver].
*
- * [packageMap] is a table mapping package names to the path of the directory
- * containing the package
+ * [packageMap] is a table mapping package names to the paths of the
+ * directories containing the package
*/
PackageMapUriResolver(this.resourceProvider, this.packageMap);
@@ -67,11 +67,15 @@ class PackageMapUriResolver extends UriResolver {
relPath = path.substring(index + 1);
}
// Try to find an existing file.
- Folder packageDir = packageMap[pkgName];
- if (packageDir != null && packageDir.exists) {
- Resource result = packageDir.getChild(relPath);
- if (result is File && result.exists) {
- return result.createSource(UriKind.PACKAGE_URI);
+ List<Folder> packageDirs = packageMap[pkgName];
+ if (packageDirs != null) {
+ for (Folder packageDir in packageDirs) {
+ if (packageDir.exists) {
+ Resource result = packageDir.getChild(relPath);
+ if (result is File && result.exists) {
+ return result.createSource(UriKind.PACKAGE_URI);
+ }
+ }
}
}
// Return a NonExistingSource instance.

Powered by Google App Engine
This is Rietveld 408576698