| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 const int _LENGTH_FROM_PATH_REQUEST = 11; | 213 const int _LENGTH_FROM_PATH_REQUEST = 11; |
| 214 const int _LAST_MODIFIED_REQUEST = 12; | 214 const int _LAST_MODIFIED_REQUEST = 12; |
| 215 const int _FLUSH_REQUEST = 13; | 215 const int _FLUSH_REQUEST = 13; |
| 216 const int _READ_BYTE_REQUEST = 14; | 216 const int _READ_BYTE_REQUEST = 14; |
| 217 const int _WRITE_BYTE_REQUEST = 15; | 217 const int _WRITE_BYTE_REQUEST = 15; |
| 218 const int _READ_REQUEST = 16; | 218 const int _READ_REQUEST = 16; |
| 219 const int _READ_LIST_REQUEST = 17; | 219 const int _READ_LIST_REQUEST = 17; |
| 220 const int _WRITE_LIST_REQUEST = 18; | 220 const int _WRITE_LIST_REQUEST = 18; |
| 221 const int _CREATE_LINK_REQUEST = 19; | 221 const int _CREATE_LINK_REQUEST = 19; |
| 222 const int _DELETE_LINK_REQUEST = 20; | 222 const int _DELETE_LINK_REQUEST = 20; |
| 223 const int _LINK_TARGET_REQUEST = 21; | 223 const int _RENAME_LINK_REQUEST = 21; |
| 224 const int _TYPE_REQUEST = 22; | 224 const int _LINK_TARGET_REQUEST = 22; |
| 225 const int _IDENTICAL_REQUEST = 23; | 225 const int _TYPE_REQUEST = 23; |
| 226 const int _STAT_REQUEST = 24; | 226 const int _IDENTICAL_REQUEST = 24; |
| 227 const int _STAT_REQUEST = 25; |
| 227 | 228 |
| 228 // TODO(ager): The only reason for this class is that the patching | 229 // TODO(ager): The only reason for this class is that the patching |
| 229 // mechanism doesn't seem to like patching a private top level | 230 // mechanism doesn't seem to like patching a private top level |
| 230 // function. | 231 // function. |
| 231 class _FileUtils { | 232 class _FileUtils { |
| 232 external static SendPort _newServicePort(); | 233 external static SendPort _newServicePort(); |
| 233 } | 234 } |
| 234 | 235 |
| 235 // Class for encapsulating the native implementation of files. | 236 // Class for encapsulating the native implementation of files. |
| 236 class _File implements File { | 237 class _File implements File { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 if (_isErrorResponse(response)) { | 328 if (_isErrorResponse(response)) { |
| 328 throw _exceptionFromResponse( | 329 throw _exceptionFromResponse( |
| 329 response, "Cannot rename file '$_path' to '$newPath'"); | 330 response, "Cannot rename file '$_path' to '$newPath'"); |
| 330 } | 331 } |
| 331 return new File(newPath); | 332 return new File(newPath); |
| 332 }); | 333 }); |
| 333 } | 334 } |
| 334 | 335 |
| 335 external static _rename(String oldPath, String newPath); | 336 external static _rename(String oldPath, String newPath); |
| 336 | 337 |
| 338 external static _renameLink(String oldPath, String newPath); |
| 339 |
| 337 File renameSync(String newPath) { | 340 File renameSync(String newPath) { |
| 338 var result = _rename(_path, newPath); | 341 var result = _rename(_path, newPath); |
| 339 throwIfError(result, "Cannot rename file '$_path' to '$newPath'"); | 342 throwIfError(result, "Cannot rename file '$_path' to '$newPath'"); |
| 340 return new File(newPath); | 343 return new File(newPath); |
| 341 } | 344 } |
| 342 | 345 |
| 343 Directory get directory { | 346 Directory get directory { |
| 344 Path path = new Path(_path).directoryPath; | 347 Path path = new Path(_path).directoryPath; |
| 345 return new Directory.fromPath(path); | 348 return new Directory.fromPath(path); |
| 346 } | 349 } |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 | 1008 |
| 1006 Future _closedException() { | 1009 Future _closedException() { |
| 1007 return new Future.error(new FileException("File closed '$_path'")); | 1010 return new Future.error(new FileException("File closed '$_path'")); |
| 1008 } | 1011 } |
| 1009 | 1012 |
| 1010 final String _path; | 1013 final String _path; |
| 1011 int _id; | 1014 int _id; |
| 1012 | 1015 |
| 1013 SendPort _fileService; | 1016 SendPort _fileService; |
| 1014 } | 1017 } |
| OLD | NEW |