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

Unified Diff: lib/src/source/hosted.dart

Issue 1276673006: Make Source.getDirectory synchronous. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 4 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 | « lib/src/source/git.dart ('k') | lib/src/source/path.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/source/hosted.dart
diff --git a/lib/src/source/hosted.dart b/lib/src/source/hosted.dart
index 5d3017b2f33a5d8e4787025412f3ed20a44b25a6..ded6e8dae3164cfb2911e6aa1f665e19a33c895f 100644
--- a/lib/src/source/hosted.dart
+++ b/lib/src/source/hosted.dart
@@ -83,14 +83,14 @@ class HostedSource extends CachedSource {
/// Downloads the package identified by [id] to the system cache.
Future<Package> downloadToSystemCache(PackageId id) async {
- if (!(await isInSystemCache(id))) {
- var packageDir = _getDirectory(id);
+ if (!isInSystemCache(id)) {
+ var packageDir = getDirectory(id);
ensureDir(path.dirname(packageDir));
var parsed = _parseDescription(id.description);
await _download(parsed.last, parsed.first, id.version, packageDir);
}
- return new Package.load(id.name, _getDirectory(id), systemCache.sources);
+ return new Package.load(id.name, getDirectory(id), systemCache.sources);
}
/// The system cache directory for the hosted source contains subdirectories
@@ -98,10 +98,7 @@ class HostedSource extends CachedSource {
///
/// Each of these subdirectories then contains a subdirectory for each
/// package downloaded from that site.
- Future<String> getDirectory(PackageId id) =>
- new Future.value(_getDirectory(id));
-
- String _getDirectory(PackageId id) {
+ String getDirectory(PackageId id) {
var parsed = _parseDescription(id.description);
var dir = _urlToDirectory(parsed.last);
return path.join(systemCacheRoot, dir, "${parsed.first}-${id.version}");
« no previous file with comments | « lib/src/source/git.dart ('k') | lib/src/source/path.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698