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 dart.io; | 5 part of dart.io; |
6 | 6 |
7 class _Directory extends FileSystemEntity implements Directory { | 7 class _Directory extends FileSystemEntity implements Directory { |
8 final String path; | 8 final String path; |
9 | 9 |
10 _Directory(this.path) { | 10 _Directory(this.path) { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } | 279 } |
280 | 280 |
281 Stream get stream => controller.stream; | 281 Stream get stream => controller.stream; |
282 | 282 |
283 void onListen() { | 283 void onListen() { |
284 _IOService.dispatch(_DIRECTORY_LIST_START, [path, recursive, followLinks]) | 284 _IOService.dispatch(_DIRECTORY_LIST_START, [path, recursive, followLinks]) |
285 .then((response) { | 285 .then((response) { |
286 if (response is int) { | 286 if (response is int) { |
287 id = response; | 287 id = response; |
288 next(); | 288 next(); |
| 289 } else if (response is Error) { |
| 290 controller.addError(response); |
| 291 close(); |
289 } else { | 292 } else { |
290 error(response); | 293 error(response); |
291 close(); | 294 close(); |
292 } | 295 } |
293 }); | 296 }); |
294 } | 297 } |
295 | 298 |
296 void onResume() { | 299 void onResume() { |
297 if (!nextRunning) next(); | 300 if (!nextRunning) next(); |
298 } | 301 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 controller.addError( | 380 controller.addError( |
378 new FileSystemException("Directory listing failed", | 381 new FileSystemException("Directory listing failed", |
379 errorPath, | 382 errorPath, |
380 err)); | 383 err)); |
381 } else { | 384 } else { |
382 controller.addError( | 385 controller.addError( |
383 new FileSystemException("Internal error")); | 386 new FileSystemException("Internal error")); |
384 } | 387 } |
385 } | 388 } |
386 } | 389 } |
OLD | NEW |