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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 339 |
340 external static _renameLink(String oldPath, String newPath); | 340 external static _renameLink(String oldPath, String newPath); |
341 | 341 |
342 File renameSync(String newPath) { | 342 File renameSync(String newPath) { |
343 var result = _rename(path, newPath); | 343 var result = _rename(path, newPath); |
344 throwIfError(result, "Cannot rename file to '$newPath'", path); | 344 throwIfError(result, "Cannot rename file to '$newPath'", path); |
345 return new File(newPath); | 345 return new File(newPath); |
346 } | 346 } |
347 | 347 |
348 Directory get directory { | 348 Directory get directory { |
349 Path path = new Path(path).directoryPath; | 349 Path path = new Path(this.path).directoryPath; |
350 return new Directory.fromPath(path); | 350 return new Directory.fromPath(path); |
351 } | 351 } |
352 | 352 |
353 Future<RandomAccessFile> open({FileMode mode: FileMode.READ}) { | 353 Future<RandomAccessFile> open({FileMode mode: FileMode.READ}) { |
354 _ensureFileService(); | 354 _ensureFileService(); |
355 if (mode != FileMode.READ && | 355 if (mode != FileMode.READ && |
356 mode != FileMode.WRITE && | 356 mode != FileMode.WRITE && |
357 mode != FileMode.APPEND) { | 357 mode != FileMode.APPEND) { |
358 return new Future.error(new ArgumentError()); | 358 return new Future.error(new ArgumentError()); |
359 } | 359 } |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 void _checkNotClosed() { | 980 void _checkNotClosed() { |
981 if (closed) { | 981 if (closed) { |
982 throw new FileException("File closed", path); | 982 throw new FileException("File closed", path); |
983 } | 983 } |
984 } | 984 } |
985 | 985 |
986 Future _closedException() { | 986 Future _closedException() { |
987 return new Future.error(new FileException("File closed", path)); | 987 return new Future.error(new FileException("File closed", path)); |
988 } | 988 } |
989 } | 989 } |
OLD | NEW |