OLD | NEW |
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 pub.source.path; | 5 library pub.source.path; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 }); | 26 }); |
27 } | 27 } |
28 | 28 |
29 bool descriptionsEqual(description1, description2) { | 29 bool descriptionsEqual(description1, description2) { |
30 // Compare real paths after normalizing and resolving symlinks. | 30 // Compare real paths after normalizing and resolving symlinks. |
31 var path1 = canonicalize(description1["path"]); | 31 var path1 = canonicalize(description1["path"]); |
32 var path2 = canonicalize(description2["path"]); | 32 var path2 = canonicalize(description2["path"]); |
33 return path1 == path2; | 33 return path1 == path2; |
34 } | 34 } |
35 | 35 |
36 /// Create a symlink from the source path directly to the destination | 36 /// Path dependencies are already local. |
37 /// directory. | 37 Future ensureLocal(PackageId id) => new Future.value(); |
38 Future get(PackageId id, String destination) { | 38 |
| 39 Future get(PackageId id, String symlink) { |
39 return syncFuture(() { | 40 return syncFuture(() { |
40 var dir = _validatePath(id.name, id.description); | 41 var dir = _validatePath(id.name, id.description); |
41 createPackageSymlink(id.name, dir, destination, | 42 createPackageSymlink(id.name, dir, symlink, |
42 relative: id.description["relative"]); | 43 relative: id.description["relative"]); |
43 }); | 44 }); |
44 } | 45 } |
45 | 46 |
46 Future<String> getDirectory(PackageId id) => | 47 Future<String> getDirectory(PackageId id) => |
47 newFuture(() => _validatePath(id.name, id.description)); | 48 newFuture(() => _validatePath(id.name, id.description)); |
48 | 49 |
49 /// Parses a path dependency. | 50 /// Parses a path dependency. |
50 /// | 51 /// |
51 /// This takes in a path string and returns a map. The "path" key will be the | 52 /// This takes in a path string and returns a map. The "path" key will be the |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 134 |
134 if (fileExists(dir)) { | 135 if (fileExists(dir)) { |
135 fail('Path dependency for package $name must refer to a directory, ' | 136 fail('Path dependency for package $name must refer to a directory, ' |
136 'not a file. Was "$dir".'); | 137 'not a file. Was "$dir".'); |
137 } | 138 } |
138 | 139 |
139 throw new PackageNotFoundException( | 140 throw new PackageNotFoundException( |
140 'Could not find package $name at "$dir".'); | 141 'Could not find package $name at "$dir".'); |
141 } | 142 } |
142 } | 143 } |
OLD | NEW |