Chromium Code Reviews| Index: tools/testing/dart/test_suite.dart |
| =================================================================== |
| --- tools/testing/dart/test_suite.dart (revision 41485) |
| +++ tools/testing/dart/test_suite.dart (working copy) |
| @@ -378,19 +378,22 @@ |
| * Helper function for discovering the packages in the dart repository. |
| */ |
| Future<List> listDir(Path path, Function isValid) { |
| - return new Directory(path.toNativePath()) |
| - .list(recursive: false) |
| - .where((fse) => fse is Directory) |
| - .map((Directory directory) { |
| - var fullPath = directory.absolute.path; |
| - var packageName = new Path(fullPath).filename; |
| - if (isValid(packageName)) { |
| - return [packageName, path.append(packageName).toNativePath()]; |
| - } |
| - return null; |
| - }) |
| - .where((name) => name != null) |
| - .toList(); |
| + var dir = new Directory(path.toNativePath()); |
| + return dir.exists().then((var exist) { |
| + if (!exist) return []; |
| + return dir.list(recursive: false) |
| + .where((fse) => fse is Directory) |
| + .map((Directory directory) { |
| + var fullPath = directory.absolute.path; |
| + var packageName = new Path(fullPath).filename; |
| + if (isValid(packageName)) { |
| + return [packageName, path.append(packageName).toNativePath()]; |
| + } |
| + return null; |
| + }) |
| + .where((name) => name != null) |
| + .toList(); |
| + }); |
|
Siggi Cherem (dart-lang)
2014/11/06 17:10:34
nit: unindent 2
|
| } |
| Future<Map> discoverPackagesInRepository() { |