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

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

Issue 23054008: Remove the Path class from dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed first round of review comments Created 7 years, 4 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 */
11 abstract class Link implements FileSystemEntity { 11 abstract class Link implements FileSystemEntity {
12 /** 12 /**
13 * Creates a Link object. 13 * Creates a Link object.
14 */ 14 */
15 factory Link(String path) => new _Link(path); 15 factory Link(String path) => new _Link(path);
16 16
17 /** 17 /**
18 * Creates a Link object from a Path object.
19 */
20 @deprecated
21 factory Link.fromPath(Path path) => new _Link.fromPath(path);
22
23 /**
24 * Creates a symbolic link. Returns a [:Future<Link>:] that completes with 18 * Creates a symbolic link. Returns a [:Future<Link>:] that completes with
25 * the link when it has been created. If the link exists, 19 * the link when it has been created. If the link exists,
26 * the future will complete with an error. 20 * the future will complete with an error.
27 * 21 *
28 * On the Windows platform, this will only work with directories, and the 22 * On the Windows platform, this will only work with directories, and the
29 * target directory must exist. The link will be created as a Junction. 23 * target directory must exist. The link will be created as a Junction.
30 * Only absolute links will be created, and relative paths to the target 24 * Only absolute links will be created, and relative paths to the target
31 * will be converted to absolute paths. 25 * will be converted to absolute paths.
32 * 26 *
33 * On other platforms, the posix symlink() call is used to make a symbolic 27 * On other platforms, the posix symlink() call is used to make a symbolic
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 SendPort _fileService; 131 SendPort _fileService;
138 132
139 _Link(String this.path) { 133 _Link(String this.path) {
140 if (path is! String) { 134 if (path is! String) {
141 throw new ArgumentError('${Error.safeToString(path)} ' 135 throw new ArgumentError('${Error.safeToString(path)} '
142 'is not a String'); 136 'is not a String');
143 } 137 }
144 } 138 }
145 139
146 140
147 _Link.fromPath(Path inputPath) : path = inputPath.toNativePath();
148
149 String toString() => "Link: '$path'"; 141 String toString() => "Link: '$path'";
150 142
151 Future<bool> exists() => FileSystemEntity.isLink(path); 143 Future<bool> exists() => FileSystemEntity.isLink(path);
152 144
153 bool existsSync() => FileSystemEntity.isLinkSync(path); 145 bool existsSync() => FileSystemEntity.isLinkSync(path);
154 146
155 Future<FileStat> stat() => FileStat.stat(path); 147 Future<FileStat> stat() => FileStat.stat(path);
156 148
157 FileStat statSync() => FileStat.statSync(path); 149 FileStat statSync() => FileStat.statSync(path);
158 150
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (path != null) { 324 if (path != null) {
333 sb.write(", path = $path"); 325 sb.write(", path = $path");
334 } 326 }
335 } 327 }
336 return sb.toString(); 328 return sb.toString();
337 } 329 }
338 final String message; 330 final String message;
339 final String path; 331 final String path;
340 final OSError osError; 332 final OSError osError;
341 } 333 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698