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

Side by Side Diff: utils/pub/path_source.dart

Issue 13332009: Make listDir and createSymlink synchronous in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/package.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library path_source; 5 library path_source;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:pathos/path.dart' as path; 10 import 'package:pathos/path.dart' as path;
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 Future<bool> install(PackageId id, String destination) { 42 Future<bool> install(PackageId id, String destination) {
43 return defer(() { 43 return defer(() {
44 try { 44 try {
45 _validatePath(id.name, id.description); 45 _validatePath(id.name, id.description);
46 } on FormatException catch(err) { 46 } on FormatException catch(err) {
47 return false; 47 return false;
48 } 48 }
49 49
50 return createPackageSymlink(id.name, id.description["path"], destination, 50 createPackageSymlink(id.name, id.description["path"], destination,
51 relative: id.description["relative"]); 51 relative: id.description["relative"]);
52 }).then((_) => true); 52 return true;
53 });
53 } 54 }
54 55
55 /// Parses a path dependency. This takes in a path string and returns a map. 56 /// Parses a path dependency. This takes in a path string and returns a map.
56 /// The "path" key will be the original path but resolved relative to the 57 /// The "path" key will be the original path but resolved relative to the
57 /// containing path. The "relative" key will be `true` if the original path 58 /// containing path. The "relative" key will be `true` if the original path
58 /// was relative. 59 /// was relative.
59 /// 60 ///
60 /// A path coming from a pubspec is a simple string. From a lock file, it's 61 /// A path coming from a pubspec is a simple string. From a lock file, it's
61 /// an expanded {"path": ..., "relative": ...} map. 62 /// an expanded {"path": ..., "relative": ...} map.
62 dynamic parseDescription(String containingPath, description, 63 dynamic parseDescription(String containingPath, description,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 111
111 if (fileExists(dir)) { 112 if (fileExists(dir)) {
112 throw new FormatException( 113 throw new FormatException(
113 "Path dependency for package '$name' must refer to a " 114 "Path dependency for package '$name' must refer to a "
114 "directory, not a file. Was '$dir'."); 115 "directory, not a file. Was '$dir'.");
115 } 116 }
116 117
117 throw new FormatException("Could not find package '$name' at '$dir'."); 118 throw new FormatException("Could not find package '$name' at '$dir'.");
118 } 119 }
119 } 120 }
OLDNEW
« no previous file with comments | « utils/pub/package.dart ('k') | utils/pub/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698