OLD | NEW |
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 class FileSystemEntityType { | 7 class FileSystemEntityType { |
8 static const FILE = const FileSystemEntityType._internal(0); | 8 static const FILE = const FileSystemEntityType._internal(0); |
9 static const DIRECTORY = const FileSystemEntityType._internal(1); | 9 static const DIRECTORY = const FileSystemEntityType._internal(1); |
10 static const LINK = const FileSystemEntityType._internal(2); | 10 static const LINK = const FileSystemEntityType._internal(2); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 * Synchronously renames this file system entity. Returns a [FileSystemEntity] | 214 * Synchronously renames this file system entity. Returns a [FileSystemEntity] |
215 * instance for the renamed entity. | 215 * instance for the renamed entity. |
216 * | 216 * |
217 * If [newPath] identifies an existing entity of the same type, that entity | 217 * If [newPath] identifies an existing entity of the same type, that entity |
218 * is replaced. If [newPath] identifies an existing entity of a different | 218 * is replaced. If [newPath] identifies an existing entity of a different |
219 * type, the operation fails and an exception is thrown. | 219 * type, the operation fails and an exception is thrown. |
220 */ | 220 */ |
221 FileSystemEntity renameSync(String newPath); | 221 FileSystemEntity renameSync(String newPath); |
222 | 222 |
223 /** | 223 /** |
| 224 * Resolves the path of a file system object relative to the |
| 225 * current working directory, resolving all symbolic links on |
| 226 * the path and resolving all '..' and '.' path segments. |
| 227 * [resolveSymbolicLinks] returns a [:Future<String>:] |
| 228 * |
| 229 * [resolveSymbolicLinks] uses the operating system's native filesystem api |
| 230 * to resolve the path, using the realpath function on linux and |
| 231 * Mac OS, and the GetFinalPathNameByHandle function on Windows. |
| 232 * If the path does not point to an existing file system object, |
| 233 * [resolveSymbolicLinks] completes the returned Future with an exception. |
| 234 * The type of the exception is determined by the type of [this], |
| 235 * so a File object gives a FileException, etc. |
| 236 */ |
| 237 Future<String> resolveSymbolicLinks(); |
| 238 |
| 239 /** |
| 240 * Resolves the path of a file system object relative to the |
| 241 * current working directory, resolving all symbolic links on |
| 242 * the path and resolving all '..' and '.' path segments. |
| 243 * |
| 244 * [resolveSymbolicLinksSync] uses the operating system's native |
| 245 * filesystem api to resolve the path, using the realpath function |
| 246 * on linux and Mac OS, and the GetFinalPathNameByHandle function on Windows. |
| 247 * If the path does not point to an existing file system object, |
| 248 * [resolveSymbolicLinksSync] throws an exception. |
| 249 * The type of the exception is determined by the type of [this], |
| 250 * so a File object gives a FileException, etc. |
| 251 */ |
| 252 String resolveSymbolicLinksSync(); |
| 253 |
| 254 /** |
224 * Calls the operating system's stat() function on the [path] of this | 255 * Calls the operating system's stat() function on the [path] of this |
225 * [FileSystemEntity]. Identical to [:FileStat.stat(this.path):]. | 256 * [FileSystemEntity]. Identical to [:FileStat.stat(this.path):]. |
226 * | 257 * |
227 * Returns a [:Future<FileStat>:] object containing the data returned by | 258 * Returns a [:Future<FileStat>:] object containing the data returned by |
228 * stat(). | 259 * stat(). |
229 * | 260 * |
230 * If the call fails, completes the future with a [FileStat] object | 261 * If the call fails, completes the future with a [FileStat] object |
231 * with .type set to | 262 * with .type set to |
232 * FileSystemEntityType.NOT_FOUND and the other fields invalid. | 263 * FileSystemEntityType.NOT_FOUND and the other fields invalid. |
233 */ | 264 */ |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, | 340 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, |
310 bool recursive: false}) | 341 bool recursive: false}) |
311 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), | 342 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), |
312 events, | 343 events, |
313 recursive).stream; | 344 recursive).stream; |
314 | 345 |
315 Future<FileSystemEntity> _delete({recursive: false}); | 346 Future<FileSystemEntity> _delete({recursive: false}); |
316 void _deleteSync({recursive: false}); | 347 void _deleteSync({recursive: false}); |
317 | 348 |
318 /** | 349 /** |
319 * Synchronously checks whether two paths refer to the same object in the | 350 * Checks whether two paths refer to the same object in the |
320 * file system. Returns a [:Future<bool>:] that completes with the result. | 351 * file system. Returns a [:Future<bool>:] that completes with the result. |
321 * | 352 * |
322 * Comparing a link to its target returns false, as does comparing two links | 353 * Comparing a link to its target returns false, as does comparing two links |
323 * that point to the same target. To check the target of a link, use | 354 * that point to the same target. To check the target of a link, use |
324 * Link.target explicitly to fetch it. Directory links appearing | 355 * Link.target explicitly to fetch it. Directory links appearing |
325 * inside a path are followed, though, to find the file system object. | 356 * inside a path are followed, though, to find the file system object. |
326 * | 357 * |
327 * Completes the returned Future with an error if one of the paths points | 358 * Completes the returned Future with an error if one of the paths points |
328 * to an object that does not exist. | 359 * to an object that does not exist. |
329 */ | 360 */ |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 } | 611 } |
581 } | 612 } |
582 | 613 |
583 | 614 |
584 abstract class _FileSystemWatcher { | 615 abstract class _FileSystemWatcher { |
585 external factory _FileSystemWatcher(String path, int events, bool recursive); | 616 external factory _FileSystemWatcher(String path, int events, bool recursive); |
586 external static bool get isSupported; | 617 external static bool get isSupported; |
587 | 618 |
588 Stream<FileSystemEvent> get stream; | 619 Stream<FileSystemEvent> get stream; |
589 } | 620 } |
OLD | NEW |