| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 * being listened to, not when the call to [watch] is issued. Note that the | 337 * being listened to, not when the call to [watch] is issued. Note that the |
| 338 * returned [Stream] is endless. To stop the [Stream], simply cancel the | 338 * returned [Stream] is endless. To stop the [Stream], simply cancel the |
| 339 * subscription. | 339 * subscription. |
| 340 */ | 340 */ |
| 341 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, | 341 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, |
| 342 bool recursive: false}) | 342 bool recursive: false}) |
| 343 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), | 343 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), |
| 344 events, | 344 events, |
| 345 recursive).stream; | 345 recursive).stream; |
| 346 | 346 |
| 347 /** |
| 348 * Test if [watch] is supported on the current system. |
| 349 * |
| 350 * Mac OS 10.6 and below is not supported. |
| 351 */ |
| 352 static bool get isWatchSupported => _FileSystemWatcher.isSupported; |
| 353 |
| 347 | 354 |
| 348 /** | 355 /** |
| 349 * Finds the type of file system object that a path points to. Returns | 356 * Finds the type of file system object that a path points to. Returns |
| 350 * a [:Future<FileSystemEntityType>:] that completes with the result. | 357 * a [:Future<FileSystemEntityType>:] that completes with the result. |
| 351 * | 358 * |
| 352 * [FileSystemEntityType] has the constant instances FILE, DIRECTORY, | 359 * [FileSystemEntityType] has the constant instances FILE, DIRECTORY, |
| 353 * LINK, and NOT_FOUND. [type] will return LINK only if the optional | 360 * LINK, and NOT_FOUND. [type] will return LINK only if the optional |
| 354 * named argument [followLinks] is false, and [path] points to a link. | 361 * named argument [followLinks] is false, and [path] points to a link. |
| 355 * If the path does not point to a file system object, or any other error | 362 * If the path does not point to a file system object, or any other error |
| 356 * occurs in looking up the path, NOT_FOUND is returned. The only | 363 * occurs in looking up the path, NOT_FOUND is returned. The only |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 buffer.write("FileSystemMoveEvent('$path'"); | 537 buffer.write("FileSystemMoveEvent('$path'"); |
| 531 if (destination != null) buffer.write(", '$destination'"); | 538 if (destination != null) buffer.write(", '$destination'"); |
| 532 buffer.write(')'); | 539 buffer.write(')'); |
| 533 return buffer.toString(); | 540 return buffer.toString(); |
| 534 } | 541 } |
| 535 } | 542 } |
| 536 | 543 |
| 537 | 544 |
| 538 abstract class _FileSystemWatcher { | 545 abstract class _FileSystemWatcher { |
| 539 external factory _FileSystemWatcher(String path, int events, bool recursive); | 546 external factory _FileSystemWatcher(String path, int events, bool recursive); |
| 547 external static bool get isSupported; |
| 540 | 548 |
| 541 Stream<FileSystemEvent> get stream; | 549 Stream<FileSystemEvent> get stream; |
| 542 } | 550 } |
| OLD | NEW |