Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: sdk/lib/io/file_impl.dart

Issue 23444037: dart:io | Change File.fullPath to FileSystemEntity.resolveSymbolicLinks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Documentation edits. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return _openFuture.then((openedFile) => openedFile.close()); 197 return _openFuture.then((openedFile) => openedFile.close());
198 } 198 }
199 } 199 }
200 200
201 201
202 const int _EXISTS_REQUEST = 0; 202 const int _EXISTS_REQUEST = 0;
203 const int _CREATE_REQUEST = 1; 203 const int _CREATE_REQUEST = 1;
204 const int _DELETE_REQUEST = 2; 204 const int _DELETE_REQUEST = 2;
205 const int _RENAME_REQUEST = 3; 205 const int _RENAME_REQUEST = 3;
206 const int _OPEN_REQUEST = 4; 206 const int _OPEN_REQUEST = 4;
207 const int _FULL_PATH_REQUEST = 5; 207 const int _RESOLVE_SYMBOLIC_LINKS_REQUEST = 5;
208 const int _CLOSE_REQUEST = 6; 208 const int _CLOSE_REQUEST = 6;
209 const int _POSITION_REQUEST = 7; 209 const int _POSITION_REQUEST = 7;
210 const int _SET_POSITION_REQUEST = 8; 210 const int _SET_POSITION_REQUEST = 8;
211 const int _TRUNCATE_REQUEST = 9; 211 const int _TRUNCATE_REQUEST = 9;
212 const int _LENGTH_REQUEST = 10; 212 const int _LENGTH_REQUEST = 10;
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;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 external static int _openStdio(int fd); 437 external static int _openStdio(int fd);
438 438
439 static RandomAccessFile _openStdioSync(int fd) { 439 static RandomAccessFile _openStdioSync(int fd) {
440 var id = _openStdio(fd); 440 var id = _openStdio(fd);
441 if (id == 0) { 441 if (id == 0) {
442 throw new FileException("Cannot open stdio file for: $fd"); 442 throw new FileException("Cannot open stdio file for: $fd");
443 } 443 }
444 return new _RandomAccessFile(id, ""); 444 return new _RandomAccessFile(id, "");
445 } 445 }
446 446
447 Future<String> fullPath() { 447 Future<String> fullPath() => resolveSymbolicLinks();
448 _ensureFileService();
449 List request = new List(2);
450 request[0] = _FULL_PATH_REQUEST;
451 request[1] = path;
452 return _fileService.call(request).then((response) {
453 if (_isErrorResponse(response)) {
454 throw _exceptionFromResponse(response,
455 "Cannot retrieve full path",
456 path);
457 }
458 return response;
459 });
460 }
461 448
462 external static _fullPath(String path); 449 String fullPathSync() => resolveSymbolicLinksSync();
463
464 String fullPathSync() {
465 var result = _fullPath(path);
466 throwIfError(result, "Cannot retrieve full path", path);
467 return result;
468 }
469 450
470 Stream<List<int>> openRead([int start, int end]) { 451 Stream<List<int>> openRead([int start, int end]) {
471 return new _FileStream(path, start, end); 452 return new _FileStream(path, start, end);
472 } 453 }
473 454
474 IOSink openWrite({FileMode mode: FileMode.WRITE, 455 IOSink openWrite({FileMode mode: FileMode.WRITE,
475 Encoding encoding: UTF8}) { 456 Encoding encoding: UTF8}) {
476 if (mode != FileMode.WRITE && 457 if (mode != FileMode.WRITE &&
477 mode != FileMode.APPEND) { 458 mode != FileMode.APPEND) {
478 throw new ArgumentError( 459 throw new ArgumentError(
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 void _checkNotClosed() { 978 void _checkNotClosed() {
998 if (closed) { 979 if (closed) {
999 throw new FileException("File closed", path); 980 throw new FileException("File closed", path);
1000 } 981 }
1001 } 982 }
1002 983
1003 Future _closedException() { 984 Future _closedException() {
1004 return new Future.error(new FileException("File closed", path)); 985 return new Future.error(new FileException("File closed", path));
1005 } 986 }
1006 } 987 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698