OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Read the file in blocks of size 64k. | 7 // Read the file in blocks of size 64k. |
8 const int _BLOCK_SIZE = 64 * 1024; | 8 const int _BLOCK_SIZE = 64 * 1024; |
9 | 9 |
10 | 10 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 | 261 |
262 external static _exists(String path); | 262 external static _exists(String path); |
263 | 263 |
264 bool existsSync() { | 264 bool existsSync() { |
265 var result = _exists(path); | 265 var result = _exists(path); |
266 throwIfError(result, "Cannot check existence of file", path); | 266 throwIfError(result, "Cannot check existence of file", path); |
267 return result; | 267 return result; |
268 } | 268 } |
269 | 269 |
| 270 File get absolute => new File(_absolutePath); |
| 271 |
270 Future<FileStat> stat() => FileStat.stat(path); | 272 Future<FileStat> stat() => FileStat.stat(path); |
271 | 273 |
272 FileStat statSync() => FileStat.statSync(path); | 274 FileStat statSync() => FileStat.statSync(path); |
273 | 275 |
274 Future<File> create() { | 276 Future<File> create() { |
275 _ensureFileService(); | 277 _ensureFileService(); |
276 List request = new List(2); | 278 List request = new List(2); |
277 request[0] = _CREATE_REQUEST; | 279 request[0] = _CREATE_REQUEST; |
278 request[1] = path; | 280 request[1] = path; |
279 return _fileService.call(request).then((response) { | 281 return _fileService.call(request).then((response) { |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 void _checkNotClosed() { | 999 void _checkNotClosed() { |
998 if (closed) { | 1000 if (closed) { |
999 throw new FileException("File closed", path); | 1001 throw new FileException("File closed", path); |
1000 } | 1002 } |
1001 } | 1003 } |
1002 | 1004 |
1003 Future _closedException() { | 1005 Future _closedException() { |
1004 return new Future.error(new FileException("File closed", path)); | 1006 return new Future.error(new FileException("File closed", path)); |
1005 } | 1007 } |
1006 } | 1008 } |
OLD | NEW |