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

Unified Diff: utils/pub/system_cache.dart

Issue 10749014: Refactor Source to take the system cache as a parameter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge Created 8 years, 5 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
« no previous file with comments | « utils/pub/source.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.';
« no previous file with comments | « utils/pub/source.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698