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

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

Issue 14642012: dart:io | Add asynchronous versions of the methods of FileSystemEntity and Link. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments 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
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 /** 7 /**
8 * [Link] objects are references to filesystem links. 8 * [Link] objects are references to filesystem links.
9 * 9 *
10 */ 10 */
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return this; 197 return this;
198 }); 198 });
199 } 199 }
200 200
201 void deleteSync() { 201 void deleteSync() {
202 var result = _File._deleteLink(path); 202 var result = _File._deleteLink(path);
203 throwIfError(result, "Cannot delete link '$path'"); 203 throwIfError(result, "Cannot delete link '$path'");
204 } 204 }
205 205
206 Future<String> target() { 206 Future<String> target() {
207 // TODO(whesse): Replace with asynchronous version. 207 _ensureFileService();
208 return new Future.sync(targetSync); 208 List request = new List(2);
209 request[0] = _LINK_TARGET_REQUEST;
210 request[1] = path;
211 return _fileService.call(request).then((response) {
212 if (_isErrorResponse(response)) {
213 throw _exceptionFromResponse(response,
214 "Cannot get target of link '$path'");
215 }
216 return response;
217 });
209 } 218 }
210 219
211 String targetSync() { 220 String targetSync() {
212 var result = _File._linkTarget(path); 221 var result = _File._linkTarget(path);
213 throwIfError(result, "Cannot read link '$path'"); 222 throwIfError(result, "Cannot read link '$path'");
214 return result; 223 return result;
215 } 224 }
216 225
217 static throwIfError(Object result, String msg) { 226 static throwIfError(Object result, String msg) {
218 if (result is OSError) { 227 if (result is OSError) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (path != null) { 275 if (path != null) {
267 sb.write(", path = $path"); 276 sb.write(", path = $path");
268 } 277 }
269 } 278 }
270 return sb.toString(); 279 return sb.toString();
271 } 280 }
272 final String message; 281 final String message;
273 final String path; 282 final String path;
274 final OSError osError; 283 final OSError osError;
275 } 284 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file_system_entity.dart ('k') | tests/standalone/io/file_read_special_device_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698