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

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

Issue 23468027: Add FileSystemEntity.absolutePath and .isAbsolute properties. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change name to absolute, return type to File, Directory, and Link. 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
« no previous file with comments | « sdk/lib/io/file_system_entity.dart ('k') | tests/standalone/io/file_absolute_path_test.dart » ('j') | 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 /** 7 /**
8 * [Link] objects are references to filesystem links. 8 * [Link] objects are references to filesystem links.
9 * 9 *
10 */ 10 */
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 * Synchronously renames this link. Returns a [Link] 78 * Synchronously renames this link. Returns a [Link]
79 * instance for the renamed link. 79 * instance for the renamed link.
80 * 80 *
81 * If [newPath] identifies an existing link, that link is 81 * If [newPath] identifies an existing link, that link is
82 * replaced. If [newPath] identifies an existing file or directory 82 * replaced. If [newPath] identifies an existing file or directory
83 * the operation fails and an exception is thrown. 83 * the operation fails and an exception is thrown.
84 */ 84 */
85 Link renameSync(String newPath); 85 Link renameSync(String newPath);
86 86
87 /** 87 /**
88 * Returns a [Link] instance whose path is the absolute path to [this].
89 *
90 * The absolute path is computed by prefixing
91 * a relative path with the current working directory, and returning
92 * an absolute path unchanged.
93 */
94 Link get absolute;
95
96 /**
88 * Gets the target of the link. Returns a future that completes with 97 * Gets the target of the link. Returns a future that completes with
89 * the path to the target. 98 * the path to the target.
90 * 99 *
91 * If the returned target is a relative path, it is relative to the 100 * If the returned target is a relative path, it is relative to the
92 * directory containing the link. 101 * directory containing the link.
93 * 102 *
94 * If the link does not exist, or is not a link, the future completes with 103 * If the link does not exist, or is not a link, the future completes with
95 * a LinkException. 104 * a LinkException.
96 */ 105 */
97 Future<String> target(); 106 Future<String> target();
(...skipping 22 matching lines...) Expand all
120 } 129 }
121 } 130 }
122 131
123 132
124 String toString() => "Link: '$path'"; 133 String toString() => "Link: '$path'";
125 134
126 Future<bool> exists() => FileSystemEntity.isLink(path); 135 Future<bool> exists() => FileSystemEntity.isLink(path);
127 136
128 bool existsSync() => FileSystemEntity.isLinkSync(path); 137 bool existsSync() => FileSystemEntity.isLinkSync(path);
129 138
139 Link get absolute => new Link(_absolutePath);
140
130 Future<FileStat> stat() => FileStat.stat(path); 141 Future<FileStat> stat() => FileStat.stat(path);
131 142
132 FileStat statSync() => FileStat.statSync(path); 143 FileStat statSync() => FileStat.statSync(path);
133 144
134 Future<Link> create(String target) { 145 Future<Link> create(String target) {
135 _ensureFileService(); 146 _ensureFileService();
136 if (Platform.operatingSystem == 'windows') { 147 if (Platform.operatingSystem == 'windows') {
137 target = _makeWindowsLinkTarget(target); 148 target = _makeWindowsLinkTarget(target);
138 } 149 }
139 List request = new List(3); 150 List request = new List(3);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (path != null) { 324 if (path != null) {
314 sb.write(", path = $path"); 325 sb.write(", path = $path");
315 } 326 }
316 } 327 }
317 return sb.toString(); 328 return sb.toString();
318 } 329 }
319 final String message; 330 final String message;
320 final String path; 331 final String path;
321 final OSError osError; 332 final OSError osError;
322 } 333 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file_system_entity.dart ('k') | tests/standalone/io/file_absolute_path_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698