Chromium Code Reviews| Index: utils/pub/system_cache.dart |
| diff --git a/utils/pub/system_cache.dart b/utils/pub/system_cache.dart |
| index c022af7d365085a03f18826bbdd532f5821bc903..3c5bb7b48c67de6befb1d4e5fa47f15491b1b67a 100644 |
| --- a/utils/pub/system_cache.dart |
| +++ b/utils/pub/system_cache.dart |
| @@ -6,6 +6,7 @@ |
| #import('io.dart'); |
| #import('package.dart'); |
| +#import('source.dart'); |
| #import('source_registry.dart'); |
| #import('utils.dart'); |
| @@ -40,6 +41,15 @@ class SystemCache { |
| sources = new SourceRegistry(); |
| /** |
| + * Registers a new source. This source may not have the same name as a source |
|
Bob Nystrom
2012/07/10 16:12:36
"may" -> "must"
nweiz
2012/07/10 18:13:01
Done.
|
| + * that's already been registered. |
| + */ |
| + void register(Source source) { |
| + source.bind(this); |
| + sources.register(source); |
| + } |
| + |
| + /** |
| * Loads all of the package ids in the cache and returns them. |
| */ |
| Future<List<PackageId>> listAll() { |
| @@ -72,8 +82,7 @@ class SystemCache { |
| var pending = _pendingInstalls[id]; |
| if (pending != null) return pending; |
| - var sourceDir = join(rootDir, id.source.name); |
| - var path = id.source.systemCacheDirectory(id, sourceDir); |
| + var path = id.source.systemCacheDirectory(id); |
| var future = exists(path).chain((exists) { |
| // TODO(nweiz): better error handling |
| if (exists) throw 'Package $id is already installed.'; |