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 static const CREATE_REQUEST = 0; | 8 static const CREATE_REQUEST = 0; |
9 static const DELETE_REQUEST = 1; | 9 static const DELETE_REQUEST = 1; |
10 static const EXISTS_REQUEST = 2; | 10 static const EXISTS_REQUEST = 2; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 bool existsSync() { | 69 bool existsSync() { |
70 var result = _exists(path); | 70 var result = _exists(path); |
71 if (result is OSError) { | 71 if (result is OSError) { |
72 throw new DirectoryException("Exists failed", path, result); | 72 throw new DirectoryException("Exists failed", path, result); |
73 } | 73 } |
74 return (result == 1); | 74 return (result == 1); |
75 } | 75 } |
76 | 76 |
| 77 Directory get absolute => new Directory(_absolutePath); |
| 78 |
77 Future<FileStat> stat() => FileStat.stat(path); | 79 Future<FileStat> stat() => FileStat.stat(path); |
78 | 80 |
79 FileStat statSync() => FileStat.statSync(path); | 81 FileStat statSync() => FileStat.statSync(path); |
80 | 82 |
81 // Compute the index of the first directory in the list that exists. If | 83 // Compute the index of the first directory in the list that exists. If |
82 // none of the directories exist dirsToCreate.length is returned. | 84 // none of the directories exist dirsToCreate.length is returned. |
83 Future<int> _computeExistingIndex(List dirsToCreate) { | 85 Future<int> _computeExistingIndex(List dirsToCreate) { |
84 var future; | 86 var future; |
85 var notFound = dirsToCreate.length; | 87 var notFound = dirsToCreate.length; |
86 for (var i = 0; i < dirsToCreate.length; i++) { | 88 for (var i = 0; i < dirsToCreate.length; i++) { |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 controller.addError( | 408 controller.addError( |
407 new DirectoryException("Directory listing failed", | 409 new DirectoryException("Directory listing failed", |
408 errorPath, | 410 errorPath, |
409 err)); | 411 err)); |
410 } else { | 412 } else { |
411 controller.addError( | 413 controller.addError( |
412 new DirectoryException("Internal error")); | 414 new DirectoryException("Internal error")); |
413 } | 415 } |
414 } | 416 } |
415 } | 417 } |
OLD | NEW |