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

Unified Diff: sdk/lib/_internal/pub/lib/src/source/path.dart

Issue 243683002: Refactor Source. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise all the things. Created 6 years, 8 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 | « sdk/lib/_internal/pub/lib/src/source/hosted.dart ('k') | sdk/lib/_internal/pub/lib/src/source/unknown.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/source/path.dart
diff --git a/sdk/lib/_internal/pub/lib/src/source/path.dart b/sdk/lib/_internal/pub/lib/src/source/path.dart
index 52f6212ab20b5ac660a11bb6ea7dcc131a76291c..e88a5770e8c2aa7055ca30c9711d1866ec375fdb 100644
--- a/sdk/lib/_internal/pub/lib/src/source/path.dart
+++ b/sdk/lib/_internal/pub/lib/src/source/path.dart
@@ -17,9 +17,8 @@ import '../utils.dart';
/// A package [Source] that gets packages from a given local file path.
class PathSource extends Source {
final name = 'path';
- final shouldCache = false;
- Future<Pubspec> describeUncached(PackageId id) {
+ Future<Pubspec> onDescribe(PackageId id) {
return syncFuture(() {
var dir = _validatePath(id.name, id.description);
return new Pubspec.load(dir, systemCache.sources,
@@ -34,17 +33,13 @@ class PathSource extends Source {
return path1 == path2;
}
- Future<bool> get(PackageId id, String destination) {
+ /// Create a symlink from the source path directly to the destination
+ /// directory.
+ Future get(PackageId id, String destination) {
return syncFuture(() {
- try {
- var dir = _validatePath(id.name, id.description);
- createPackageSymlink(id.name, dir, destination,
- relative: id.description["relative"]);
- } on FormatException catch(err) {
- return false;
- }
-
- return true;
+ var dir = _validatePath(id.name, id.description);
+ createPackageSymlink(id.name, dir, destination,
+ relative: id.description["relative"]);
});
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/source/hosted.dart ('k') | sdk/lib/_internal/pub/lib/src/source/unknown.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698