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 /** | 7 /** |
8 * The type of an entity on the file system, such as a file, directory, or link. | 8 * The type of an entity on the file system, such as a file, directory, or link. |
9 * | 9 * |
10 * These constants are used by the [FileSystemEntity] class | 10 * These constants are used by the [FileSystemEntity] class |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 */ | 266 */ |
267 FileSystemEntity renameSync(String newPath); | 267 FileSystemEntity renameSync(String newPath); |
268 | 268 |
269 /** | 269 /** |
270 * Resolves the path of a file system object relative to the | 270 * Resolves the path of a file system object relative to the |
271 * current working directory, resolving all symbolic links on | 271 * current working directory, resolving all symbolic links on |
272 * the path and resolving all `..` and `.` path segments. | 272 * the path and resolving all `..` and `.` path segments. |
273 * | 273 * |
274 * [resolveSymbolicLinks] uses the operating system's native | 274 * [resolveSymbolicLinks] uses the operating system's native |
275 * file system API to resolve the path, using the `realpath` function | 275 * file system API to resolve the path, using the `realpath` function |
276 * on linux and Mac OS, and the `GetFinalPathNameByHandle` function on | 276 * on linux and OS X, and the `GetFinalPathNameByHandle` function on |
277 * Windows. If the path does not point to an existing file system object, | 277 * Windows. If the path does not point to an existing file system object, |
278 * `resolveSymbolicLinks` throws a `FileSystemException`. | 278 * `resolveSymbolicLinks` throws a `FileSystemException`. |
279 * | 279 * |
280 * On Windows the `..` segments are resolved _before_ resolving the symbolic | 280 * On Windows the `..` segments are resolved _before_ resolving the symbolic |
281 * link, and on other platforms the symbolic links are _resolved to their | 281 * link, and on other platforms the symbolic links are _resolved to their |
282 * target_ before applying a `..` that follows. | 282 * target_ before applying a `..` that follows. |
283 * | 283 * |
284 * To ensure the same behavior on all platforms resolve `..` segments before | 284 * To ensure the same behavior on all platforms resolve `..` segments before |
285 * calling `resolveSymbolicLinks`. One way of doing this is with the `Uri` | 285 * calling `resolveSymbolicLinks`. One way of doing this is with the `Uri` |
286 * class: | 286 * class: |
(...skipping 19 matching lines...) Expand all Loading... |
306 }); | 306 }); |
307 } | 307 } |
308 | 308 |
309 /** | 309 /** |
310 * Resolves the path of a file system object relative to the | 310 * Resolves the path of a file system object relative to the |
311 * current working directory, resolving all symbolic links on | 311 * current working directory, resolving all symbolic links on |
312 * the path and resolving all `..` and `.` path segments. | 312 * the path and resolving all `..` and `.` path segments. |
313 * | 313 * |
314 * [resolveSymbolicLinksSync] uses the operating system's native | 314 * [resolveSymbolicLinksSync] uses the operating system's native |
315 * file system API to resolve the path, using the `realpath` function | 315 * file system API to resolve the path, using the `realpath` function |
316 * on linux and Mac OS, and the `GetFinalPathNameByHandle` function on | 316 * on linux and OS X, and the `GetFinalPathNameByHandle` function on |
317 * Windows. If the path does not point to an existing file system object, | 317 * Windows. If the path does not point to an existing file system object, |
318 * `resolveSymbolicLinksSync` throws a `FileSystemException`. | 318 * `resolveSymbolicLinksSync` throws a `FileSystemException`. |
319 * | 319 * |
320 * On Windows the `..` segments are resolved _before_ resolving the symbolic | 320 * On Windows the `..` segments are resolved _before_ resolving the symbolic |
321 * link, and on other platforms the symbolic links are _resolved to their | 321 * link, and on other platforms the symbolic links are _resolved to their |
322 * target_ before applying a `..` that follows. | 322 * target_ before applying a `..` that follows. |
323 * | 323 * |
324 * To ensure the same behavior on all platforms resolve `..` segments before | 324 * To ensure the same behavior on all platforms resolve `..` segments before |
325 * calling `resolveSymbolicLinksSync`. One way of doing this is with the `Uri` | 325 * calling `resolveSymbolicLinksSync`. One way of doing this is with the `Uri` |
326 * class: | 326 * class: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 * | 411 * |
412 * The implementation uses platform-dependent event-based APIs for receiving | 412 * The implementation uses platform-dependent event-based APIs for receiving |
413 * file-system notifications, thus behavior depends on the platform. | 413 * file-system notifications, thus behavior depends on the platform. |
414 * | 414 * |
415 * * `Windows`: Uses `ReadDirectoryChangesW`. The implementation only | 415 * * `Windows`: Uses `ReadDirectoryChangesW`. The implementation only |
416 * supports watching directories. Recursive watching is supported. | 416 * supports watching directories. Recursive watching is supported. |
417 * * `Linux`: Uses `inotify`. The implementation supports watching both | 417 * * `Linux`: Uses `inotify`. The implementation supports watching both |
418 * files and directories. Recursive watching is not supported. | 418 * files and directories. Recursive watching is not supported. |
419 * Note: When watching files directly, delete events might not happen | 419 * Note: When watching files directly, delete events might not happen |
420 * as expected. | 420 * as expected. |
421 * * `Mac OS`: Uses `FSEvents`. The implementation supports watching both | 421 * * `OS X`: Uses `FSEvents`. The implementation supports watching both |
422 * files and directories. Recursive watching is supported. | 422 * files and directories. Recursive watching is supported. |
423 * | 423 * |
424 * The system will start listening for events once the returned [Stream] is | 424 * The system will start listening for events once the returned [Stream] is |
425 * being listened to, not when the call to [watch] is issued. | 425 * being listened to, not when the call to [watch] is issued. |
426 * | 426 * |
427 * The returned value is an endless broadcast [Stream], that only stops when | 427 * The returned value is an endless broadcast [Stream], that only stops when |
428 * one of the following happends: | 428 * one of the following happends: |
429 * | 429 * |
430 * * The [Stream] is canceled, e.g. by calling `cancel` on the | 430 * * The [Stream] is canceled, e.g. by calling `cancel` on the |
431 * [StreamSubscription]. | 431 * [StreamSubscription]. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 */ | 522 */ |
523 static bool identicalSync(String path1, String path2) { | 523 static bool identicalSync(String path1, String path2) { |
524 var result = _identical(path1, path2); | 524 var result = _identical(path1, path2); |
525 _throwIfError(result, 'Error in FileSystemEntity.identicalSync'); | 525 _throwIfError(result, 'Error in FileSystemEntity.identicalSync'); |
526 return result; | 526 return result; |
527 } | 527 } |
528 | 528 |
529 /** | 529 /** |
530 * Test if [watch] is supported on the current system. | 530 * Test if [watch] is supported on the current system. |
531 * | 531 * |
532 * Mac OS 10.6 and below is not supported. | 532 * OS X 10.6 and below is not supported. |
533 */ | 533 */ |
534 static bool get isWatchSupported => _FileSystemWatcher.isSupported; | 534 static bool get isWatchSupported => _FileSystemWatcher.isSupported; |
535 | 535 |
536 /** | 536 /** |
537 * Finds the type of file system object that a path points to. Returns | 537 * Finds the type of file system object that a path points to. Returns |
538 * a [:Future<FileSystemEntityType>:] that completes with the result. | 538 * a [:Future<FileSystemEntityType>:] that completes with the result. |
539 * | 539 * |
540 * [FileSystemEntityType] has the constant instances FILE, DIRECTORY, | 540 * [FileSystemEntityType] has the constant instances FILE, DIRECTORY, |
541 * LINK, and NOT_FOUND. [type] will return LINK only if the optional | 541 * LINK, and NOT_FOUND. [type] will return LINK only if the optional |
542 * named argument [followLinks] is false, and [path] points to a link. | 542 * named argument [followLinks] is false, and [path] points to a link. |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 return buffer.toString(); | 824 return buffer.toString(); |
825 } | 825 } |
826 } | 826 } |
827 | 827 |
828 | 828 |
829 class _FileSystemWatcher { | 829 class _FileSystemWatcher { |
830 external static Stream<FileSystemEvent> watch( | 830 external static Stream<FileSystemEvent> watch( |
831 String path, int events, bool recursive); | 831 String path, int events, bool recursive); |
832 external static bool get isSupported; | 832 external static bool get isSupported; |
833 } | 833 } |
OLD | NEW |