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

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

Issue 14737005: dart:io | Improve text of FileIOException on File.exists(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Constructor from Path for file. 221 // Constructor from Path for file.
222 _File.fromPath(Path path) : this(path.toNativePath()); 222 _File.fromPath(Path path) : this(path.toNativePath());
223 223
224 Future<bool> exists() { 224 Future<bool> exists() {
225 _ensureFileService(); 225 _ensureFileService();
226 List request = new List(2); 226 List request = new List(2);
227 request[0] = _EXISTS_REQUEST; 227 request[0] = _EXISTS_REQUEST;
228 request[1] = _path; 228 request[1] = _path;
229 return _fileService.call(request).then((response) { 229 return _fileService.call(request).then((response) {
230 if (_isErrorResponse(response)) { 230 if (_isErrorResponse(response)) {
231 throw _exceptionFromResponse(response, "Cannot open file '$_path'"); 231 throw _exceptionFromResponse(response,
232 "Cannot check existence of file '$_path'");
232 } 233 }
233 return response; 234 return response;
234 }); 235 });
235 } 236 }
236 237
237 external static _exists(String path); 238 external static _exists(String path);
238 239
239 bool existsSync() { 240 bool existsSync() {
240 var result = _exists(_path); 241 var result = _exists(_path);
241 throwIfError(result, "Cannot check existence of file '$_path'"); 242 throwIfError(result, "Cannot check existence of file '$_path'");
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 new FileIOException("File closed '$_path'")); 1010 new FileIOException("File closed '$_path'"));
1010 }); 1011 });
1011 return completer.future; 1012 return completer.future;
1012 } 1013 }
1013 1014
1014 final String _path; 1015 final String _path;
1015 int _id; 1016 int _id;
1016 1017
1017 SendPort _fileService; 1018 SendPort _fileService;
1018 } 1019 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698