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

Side by Side Diff: sdk/lib/io/directory_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: Document resolution of link\.. on Windows. 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class _Directory extends FileSystemEntity implements Directory { 7 class _Directory extends FileSystemEntity implements Directory {
8 static const CREATE_REQUEST = 0; 8 static const CREATE_REQUEST = 0;
9 static const DELETE_REQUEST = 1; 9 static const DELETE_REQUEST = 1;
10 static const EXISTS_REQUEST = 2; 10 static const EXISTS_REQUEST = 2;
11 static const CREATE_TEMP_REQUEST = 3; 11 static const CREATE_TEMP_REQUEST = 3;
12 static const LIST_START_REQUEST = 4; 12 static const LIST_START_REQUEST = 4;
13 static const LIST_NEXT_REQUEST = 5; 13 static const LIST_NEXT_REQUEST = 5;
14 static const LIST_STOP_REQUEST = 6; 14 static const LIST_STOP_REQUEST = 6;
15 static const RENAME_REQUEST = 7; 15 static const RENAME_REQUEST = 7;
16 static const RESOLVE_SYMBOLIC_LINKS_REQUEST = 8;
16 17
17 final String path; 18 final String path;
18 SendPort _directoryService; 19 SendPort _directoryService;
19 20
20 _Directory(String this.path) { 21 _Directory(String this.path) {
21 if (path is! String) { 22 if (path is! String) {
22 throw new ArgumentError('${Error.safeToString(path)} ' 23 throw new ArgumentError('${Error.safeToString(path)} '
23 'is not a String'); 24 'is not a String');
24 } 25 }
25 } 26 }
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 }); 198 });
198 } 199 }
199 200
200 void _deleteSync({recursive: false}) { 201 void _deleteSync({recursive: false}) {
201 var result = _deleteNative(path, recursive); 202 var result = _deleteNative(path, recursive);
202 if (result is OSError) { 203 if (result is OSError) {
203 throw new DirectoryException("Deletion failed", path, result); 204 throw new DirectoryException("Deletion failed", path, result);
204 } 205 }
205 } 206 }
206 207
208 Future<String> resolveSymbolicLinks() {
209 _ensureDirectoryService();
210 List request = new List(2);
211 request[0] = RESOLVE_SYMBOLIC_LINKS_REQUEST;
212 request[1] = path;
213 return _directoryService.call(request).then((response) {
214 if (_isErrorResponse(response)) {
215 throw _exceptionOrErrorFromResponse(response,
216 "Cannot resolve symbolic links");
217 }
218 return response;
219 });
220 }
221
222 String resolveSymbolicLinksSync() {
223 var result = _File._resolveSymbolicLinks(path);
224 if (result is OSError) {
225 throw new DirectoryException(
226 "Cannot resolve symbolic links", path, result);
227 }
228 return result;
229 }
230
207 Future<Directory> rename(String newPath) { 231 Future<Directory> rename(String newPath) {
208 _ensureDirectoryService(); 232 _ensureDirectoryService();
209 List request = new List(3); 233 List request = new List(3);
210 request[0] = RENAME_REQUEST; 234 request[0] = RENAME_REQUEST;
211 request[1] = path; 235 request[1] = path;
212 request[2] = newPath; 236 request[2] = newPath;
213 return _directoryService.call(request).then((response) { 237 return _directoryService.call(request).then((response) {
214 if (_isErrorResponse(response)) { 238 if (_isErrorResponse(response)) {
215 throw _exceptionOrErrorFromResponse(response, "Rename failed"); 239 throw _exceptionOrErrorFromResponse(response, "Rename failed");
216 } 240 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 controller.addError( 423 controller.addError(
400 new DirectoryException("Directory listing failed", 424 new DirectoryException("Directory listing failed",
401 errorPath, 425 errorPath,
402 err)); 426 err));
403 } else { 427 } else {
404 controller.addError( 428 controller.addError(
405 new DirectoryException("Internal error")); 429 new DirectoryException("Internal error"));
406 } 430 }
407 } 431 }
408 } 432 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698