| 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 /// Helper functionality to make working with IO easier. | 5 /// Helper functionality to make working with IO easier. |
| 6 library io; | 6 library io; |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 10 import 'dart:json'; | 10 import 'dart:json'; |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 stackTrace = localStackTrace; | 265 stackTrace = localStackTrace; |
| 266 } | 266 } |
| 267 | 267 |
| 268 var children = []; | 268 var children = []; |
| 269 lister.onError = (error) => completer.completeException(error, stackTrace); | 269 lister.onError = (error) => completer.completeException(error, stackTrace); |
| 270 lister.onDir = (file) { | 270 lister.onDir = (file) { |
| 271 if (!includeHiddenFiles && basename(file).startsWith('.')) return; | 271 if (!includeHiddenFiles && basename(file).startsWith('.')) return; |
| 272 file = join(dir, basename(file)); | 272 file = join(dir, basename(file)); |
| 273 contents.add(file); | 273 contents.add(file); |
| 274 | 274 |
| 275 // TODO(nweiz): don't manually recurse once issue 7358 is fixed. | 275 // TODO(nweiz): don't manually recurse once issue 7358 is fixed. Note that |
| 276 // once we remove the manual recursion, we'll need to explicitly filter |
| 277 // out files in hidden directories. |
| 276 if (recursive) { | 278 if (recursive) { |
| 277 children.add(doList(new Directory(file), listedDirectories)); | 279 children.add(doList(new Directory(file), listedDirectories)); |
| 278 } | 280 } |
| 279 }; | 281 }; |
| 280 lister.onFile = (file) { | 282 lister.onFile = (file) { |
| 281 if (!includeHiddenFiles && basename(file).startsWith('.')) return; | 283 if (!includeHiddenFiles && basename(file).startsWith('.')) return; |
| 282 contents.add(join(dir, basename(file))); | 284 contents.add(join(dir, basename(file))); |
| 283 }; | 285 }; |
| 284 | 286 |
| 285 return completer.future.chain((contents) { | 287 return completer.future.chain((contents) { |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 Directory _getDirectory(entry) { | 971 Directory _getDirectory(entry) { |
| 970 if (entry is Directory) return entry; | 972 if (entry is Directory) return entry; |
| 971 return new Directory(entry); | 973 return new Directory(entry); |
| 972 } | 974 } |
| 973 | 975 |
| 974 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. | 976 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. |
| 975 Uri _getUri(uri) { | 977 Uri _getUri(uri) { |
| 976 if (uri is Uri) return uri; | 978 if (uri is Uri) return uri; |
| 977 return new Uri.fromString(uri); | 979 return new Uri.fromString(uri); |
| 978 } | 980 } |
| OLD | NEW |