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) { | 289 } else if (response is Error) { |
290 controller.addError(response); | 290 controller.addError(response, response.stackTrace); |
291 close(); | 291 close(); |
292 } else { | 292 } else { |
293 error(response); | 293 error(response); |
294 close(); | 294 close(); |
295 } | 295 } |
296 }); | 296 }); |
297 } | 297 } |
298 | 298 |
299 void onResume() { | 299 void onResume() { |
300 if (!nextRunning) next(); | 300 if (!nextRunning) next(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 controller.addError(new ArgumentError()); | 372 controller.addError(new ArgumentError()); |
373 } else if (errorType == _OSERROR_RESPONSE) { | 373 } else if (errorType == _OSERROR_RESPONSE) { |
374 var responseError = message[RESPONSE_ERROR]; | 374 var responseError = message[RESPONSE_ERROR]; |
375 var err = new OSError( | 375 var err = new OSError( |
376 responseError[_OSERROR_RESPONSE_MESSAGE], | 376 responseError[_OSERROR_RESPONSE_MESSAGE], |
377 responseError[_OSERROR_RESPONSE_ERROR_CODE]); | 377 responseError[_OSERROR_RESPONSE_ERROR_CODE]); |
378 var errorPath = message[RESPONSE_PATH]; | 378 var errorPath = message[RESPONSE_PATH]; |
379 if (errorPath == null) errorPath = path; | 379 if (errorPath == null) errorPath = path; |
380 controller.addError( | 380 controller.addError( |
381 new FileSystemException("Directory listing failed", | 381 new FileSystemException("Directory listing failed", |
382 errorPath, | 382 errorPath, |
383 err)); | 383 err)); |
384 } else { | 384 } else { |
385 controller.addError( | 385 controller.addError( |
386 new FileSystemException("Internal error")); | 386 new FileSystemException("Internal error")); |
387 } | 387 } |
388 } | 388 } |
389 } | 389 } |
OLD | NEW |