| OLD | NEW |
| 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 /** Create a file [fileName] and populate it with [contents]. */ | 7 /** Create a file [fileName] and populate it with [contents]. */ |
| 8 void writeFile(String fileName, String contents) { | 8 void writeFile(String fileName, String contents) { |
| 9 var file = new File(fileName); | 9 var file = new File(fileName); |
| 10 file.writeAsStringSync(contents); | 10 file.writeAsStringSync(contents); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Given a file path [path], make it absolute if it is relative, | 31 * Given a file path [path], make it absolute if it is relative, |
| 32 * and return the result. | 32 * and return the result. |
| 33 */ | 33 */ |
| 34 String makePathAbsolute(String path) { | 34 String makePathAbsolute(String path) { |
| 35 var p = new Path(path).canonicalize(); | 35 var p = new Path(path).canonicalize(); |
| 36 if (p.isAbsolute) { | 36 if (p.isAbsolute) { |
| 37 return p.toNativePath(); | 37 return p.toNativePath(); |
| 38 } else { | 38 } else { |
| 39 var cwd = new Path((new Directory.current()).path); | 39 var cwd = new Path(Directory.current.path); |
| 40 return cwd.join(p).toNativePath(); | 40 return cwd.join(p).toNativePath(); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Create the list of all the files in a set of directories | 45 * Create the list of all the files in a set of directories |
| 46 * ([dirs]) whose names match [filePat]. If [recurse] is true | 46 * ([dirs]) whose names match [filePat]. If [recurse] is true |
| 47 * look at subdirectories too. An optional [excludePat] can be supplied | 47 * look at subdirectories too. An optional [excludePat] can be supplied |
| 48 * and files or directories that match that will be excluded. | 48 * and files or directories that match that will be excluded. |
| 49 * [includeSymLinks] controls whether or not to include files that | 49 * [includeSymLinks] controls whether or not to include files that |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 options = new ProcessOptions(); | 109 options = new ProcessOptions(); |
| 110 options.workingDirectory = workingDir; | 110 options.workingDirectory = workingDir; |
| 111 } | 111 } |
| 112 return Process.run(command, args, options) | 112 return Process.run(command, args, options) |
| 113 .then((result) => result.exitCode) | 113 .then((result) => result.exitCode) |
| 114 .catchError((e) { | 114 .catchError((e) { |
| 115 print("$command ${args.join(' ')}: ${e.toString()}"); | 115 print("$command ${args.join(' ')}: ${e.toString()}"); |
| 116 }); | 116 }); |
| 117 } | 117 } |
| 118 | 118 |
| OLD | NEW |