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

Side by Side Diff: utils/testrunner/utils.dart

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of testrunner; 5 part of testrunner;
6 6
7 /** 7 /**
8 * Read the contents of a file [fileName] into a [List] of [String]s. 8 * Read the contents of a file [fileName] into a [List] of [String]s.
9 * If the file does not exist and [errorIfNoFile] is true, throw an 9 * If the file does not exist and [errorIfNoFile] is true, throw an
10 * exception, else return an empty list. 10 * exception, else return an empty list.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 File f = new File(path); 63 File f = new File(path);
64 if (f.existsSync()) { 64 if (f.existsSync()) {
65 if (filePat.hasMatch(path)) { 65 if (filePat.hasMatch(path)) {
66 files.add(path); 66 files.add(path);
67 } 67 }
68 } else { // Try treat it as a directory. 68 } else { // Try treat it as a directory.
69 path = makePathAbsolute(path); 69 path = makePathAbsolute(path);
70 Directory d = new Directory(path); 70 Directory d = new Directory(path);
71 if (d.existsSync()) { 71 if (d.existsSync()) {
72 ++dirCount; 72 ++dirCount;
73 var lister = d.list(recursive: recurse); 73 d.list(recursive: recurse).listen(
74 lister.onFile = (file) { 74 (entity) {
75 if (filePat.hasMatch(file)) { 75 if (entity is File) {
76 if (excludePat == null || !excludePat.hasMatch(file)) { 76 var file = entity.name;
77 if (includeSymLinks || file.startsWith(path)) { 77 if (filePat.hasMatch(file)) {
78 files.add(file); 78 if (excludePat == null || !excludePat.hasMatch(file)) {
79 if (includeSymLinks || file.startsWith(path)) {
80 files.add(file);
81 }
82 }
83 }
79 } 84 }
80 } 85 },
81 } 86 onDone: () {
82 }; 87 if (complete && --dirCount == 0) {
83 lister.onDone = (complete) { 88 onComplete(files);
84 if (complete && --dirCount == 0) { 89 }
85 onComplete(files); 90 });
86 }
87 };
88 } else { // Does not exist. 91 } else { // Does not exist.
89 print('$path does not exist.'); 92 print('$path does not exist.');
90 } 93 }
91 } 94 }
92 } 95 }
93 if (--dirCount == 0) { 96 if (--dirCount == 0) {
94 onComplete(files); 97 onComplete(files);
95 } 98 }
96 } 99 }
97 100
98 /** 101 /**
99 * Get the directory that testrunner lives in; we need it to import 102 * Get the directory that testrunner lives in; we need it to import
100 * support files into the generated scripts. 103 * support files into the generated scripts.
101 */ 104 */
102 105
103 String get runnerDirectory { 106 String get runnerDirectory {
104 var libDirectory = makePathAbsolute(new Options().script); 107 var libDirectory = makePathAbsolute(new Options().script);
105 return libDirectory.substring(0, 108 return libDirectory.substring(0,
106 libDirectory.lastIndexOf(Platform.pathSeparator)); 109 libDirectory.lastIndexOf(Platform.pathSeparator));
107 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698