| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 bool existsSync() { | 61 bool existsSync() { |
| 62 var result = _exists(path); | 62 var result = _exists(path); |
| 63 if (result is OSError) { | 63 if (result is OSError) { |
| 64 throw new FileSystemException("Exists failed", path, result); | 64 throw new FileSystemException("Exists failed", path, result); |
| 65 } | 65 } |
| 66 return (result == 1); | 66 return (result == 1); |
| 67 } | 67 } |
| 68 | 68 |
| 69 Directory get absolute => new Directory(_absolutePath); | 69 Directory get absolute => new Directory(_absolutePath); |
| 70 | 70 |
| 71 Future<FileStat> stat() => FileStat.stat(path); | |
| 72 | |
| 73 FileStat statSync() => FileStat.statSync(path); | |
| 74 | |
| 75 Future<Directory> create({bool recursive: false}) { | 71 Future<Directory> create({bool recursive: false}) { |
| 76 if (recursive) { | 72 if (recursive) { |
| 77 return exists().then((exists) { | 73 return exists().then((exists) { |
| 78 if (exists) return this; | 74 if (exists) return this; |
| 79 if (path != parent.path) { | 75 if (path != parent.path) { |
| 80 return parent.create(recursive: true).then((_) { | 76 return parent.create(recursive: true).then((_) { |
| 81 return create(); | 77 return create(); |
| 82 }); | 78 }); |
| 83 } else { | 79 } else { |
| 84 return create(); | 80 return create(); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 controller.addError( | 391 controller.addError( |
| 396 new FileSystemException("Directory listing failed", | 392 new FileSystemException("Directory listing failed", |
| 397 errorPath, | 393 errorPath, |
| 398 err)); | 394 err)); |
| 399 } else { | 395 } else { |
| 400 controller.addError( | 396 controller.addError( |
| 401 new FileSystemException("Internal error")); | 397 new FileSystemException("Internal error")); |
| 402 } | 398 } |
| 403 } | 399 } |
| 404 } | 400 } |
| OLD | NEW |