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

Unified Diff: utils/pub/source.dart

Issue 12255016: Get rid of old redundant methods in io.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise and update to latest. Created 7 years, 10 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/pub.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/source.dart
diff --git a/utils/pub/source.dart b/utils/pub/source.dart
index da6b0b72db7d82e7d30d8e00dd5ece569463b7b7..30fd5ebbebdbca61ebc9368357caf32366cbe5df 100644
--- a/utils/pub/source.dart
+++ b/utils/pub/source.dart
@@ -5,6 +5,9 @@
library source;
import 'dart:async';
+
+import '../../pkg/path/lib/path.dart' as path;
+
import 'io.dart';
import 'package.dart';
import 'pubspec.dart';
@@ -105,26 +108,26 @@ abstract class Source {
///
/// By default, this uses [systemCacheDirectory] and [install].
Future<Package> installToSystemCache(PackageId id) {
- var path;
+ var packageDir;
return systemCacheDirectory(id).then((p) {
- path = p;
+ packageDir = p;
// See if it's already cached.
- if (!dirExists(path)) return false;
+ if (!dirExists(packageDir)) return false;
- return _isCachedPackageCorrupted(path).then((isCorrupted) {
+ return _isCachedPackageCorrupted(packageDir).then((isCorrupted) {
if (!isCorrupted) return true;
// Busted, so wipe out the package and reinstall.
- return deleteDir(path).then((_) => false);
+ return deleteDir(packageDir).then((_) => false);
});
}).then((isInstalled) {
if (isInstalled) return true;
- ensureDir(dirname(path));
- return install(id, path);
+ ensureDir(path.dirname(packageDir));
+ return install(id, packageDir);
}).then((found) {
if (!found) throw 'Package $id not found.';
- return new Package.load(id.name, path, systemCache.sources);
+ return new Package.load(id.name, packageDir, systemCache.sources);
});
}
« no previous file with comments | « utils/pub/pub.dart ('k') | utils/pub/system_cache.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698