| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 * * The [Stream] is canceled, e.g. by calling `cancel` on the | 363 * * The [Stream] is canceled, e.g. by calling `cancel` on the |
| 364 * [StreamSubscription]. | 364 * [StreamSubscription]. |
| 365 * * The [FileSystemEntity] being watches, is deleted. | 365 * * The [FileSystemEntity] being watches, is deleted. |
| 366 * | 366 * |
| 367 * Use `events` to specify what events to listen for. The constants in | 367 * Use `events` to specify what events to listen for. The constants in |
| 368 * [FileSystemEvent] can be or'ed together to mix events. Default is | 368 * [FileSystemEvent] can be or'ed together to mix events. Default is |
| 369 * [FileSystemEvent.ALL]. | 369 * [FileSystemEvent.ALL]. |
| 370 */ | 370 */ |
| 371 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, | 371 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, |
| 372 bool recursive: false}) | 372 bool recursive: false}) |
| 373 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), | 373 => _FileSystemWatcher.watch(_trimTrailingPathSeparators(path), |
| 374 events, | 374 events, |
| 375 recursive).stream; | 375 recursive); |
| 376 | 376 |
| 377 Future<FileSystemEntity> _delete({bool recursive: false}); | 377 Future<FileSystemEntity> _delete({bool recursive: false}); |
| 378 void _deleteSync({bool recursive: false}); | 378 void _deleteSync({bool recursive: false}); |
| 379 | 379 |
| 380 /** | 380 /** |
| 381 * Checks whether two paths refer to the same object in the | 381 * Checks whether two paths refer to the same object in the |
| 382 * file system. Returns a [:Future<bool>:] that completes with the result. | 382 * file system. Returns a [:Future<bool>:] that completes with the result. |
| 383 * | 383 * |
| 384 * Comparing a link to its target returns false, as does comparing two links | 384 * Comparing a link to its target returns false, as does comparing two links |
| 385 * that point to the same target. To check the target of a link, use | 385 * that point to the same target. To check the target of a link, use |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 String toString() { | 734 String toString() { |
| 735 var buffer = new StringBuffer(); | 735 var buffer = new StringBuffer(); |
| 736 buffer.write("FileSystemMoveEvent('$path'"); | 736 buffer.write("FileSystemMoveEvent('$path'"); |
| 737 if (destination != null) buffer.write(", '$destination'"); | 737 if (destination != null) buffer.write(", '$destination'"); |
| 738 buffer.write(')'); | 738 buffer.write(')'); |
| 739 return buffer.toString(); | 739 return buffer.toString(); |
| 740 } | 740 } |
| 741 } | 741 } |
| 742 | 742 |
| 743 | 743 |
| 744 abstract class _FileSystemWatcher { | 744 class _FileSystemWatcher { |
| 745 external factory _FileSystemWatcher(String path, int events, bool recursive); | 745 external static Stream<FileSystemEvent> watch( |
| 746 String path, int events, bool recursive); |
| 746 external static bool get isSupported; | 747 external static bool get isSupported; |
| 747 | |
| 748 Stream<FileSystemEvent> get stream; | |
| 749 } | 748 } |
| OLD | NEW |