| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 * This behavior allows [deleteSync] to be used to unconditionally delete any | 333 * This behavior allows [deleteSync] to be used to unconditionally delete any |
| 334 * file system object. | 334 * file system object. |
| 335 * | 335 * |
| 336 * Throws an exception if the [FileSystemEntity] cannot be deleted. | 336 * Throws an exception if the [FileSystemEntity] cannot be deleted. |
| 337 */ | 337 */ |
| 338 void deleteSync({bool recursive: false}) | 338 void deleteSync({bool recursive: false}) |
| 339 => _deleteSync(recursive: recursive); | 339 => _deleteSync(recursive: recursive); |
| 340 | 340 |
| 341 | 341 |
| 342 /** | 342 /** |
| 343 * Start watch the [FileSystemEntity] for changes. | 343 * Start watching the [FileSystemEntity] for changes. |
| 344 * | 344 * |
| 345 * The implementation uses platform-depending event-based APIs for receiving | 345 * The implementation uses platform-dependent event-based APIs for receiving |
| 346 * file-system notifixations, thus behvaiour depends on the platform. | 346 * file-system notifications, thus behavior depends on the platform. |
| 347 * | 347 * |
| 348 * * `Windows`: Uses `ReadDirectoryChangesW`. The implementation supports | 348 * * `Windows`: Uses `ReadDirectoryChangesW`. The implementation only |
| 349 * only watching dirctories but supports recursive watching. | 349 * supports watching directories. Recursive watching is supported. |
| 350 * * `Linux`: Uses `inotify`. The implementation supports watching both | 350 * * `Linux`: Uses `inotify`. The implementation supports watching both |
| 351 * files and dirctories, but doesn't support recursive watching. | 351 * files and directories. Recursive watching is not supported. |
| 352 * * `Mac OS`: Uses `FSEvents`. The implementation supports watching both | 352 * * `Mac OS`: Uses `FSEvents`. The implementation supports watching both |
| 353 * files and dirctories, and also recursive watching. Note that FSEvents | 353 * files and directories. Recursive watching is supported. |
| 354 * always use recursion internally, so when disabled, some events are | |
| 355 * ignored. | |
| 356 * | 354 * |
| 357 * The system will start listen for events once the returned [Stream] is | 355 * The system will start listening for events once the returned [Stream] is |
| 358 * being listened to, not when the call to [watch] is issued. Note that the | 356 * being listened to, not when the call to [watch] is issued. Note that the |
| 359 * returned [Stream] is endless. To stop the [Stream], simply cancel the | 357 * returned [Stream] is endless. To stop the [Stream], cancel the subscription
. |
| 360 * subscription. | |
| 361 */ | 358 */ |
| 362 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, | 359 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, |
| 363 bool recursive: false}) | 360 bool recursive: false}) |
| 364 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), | 361 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), |
| 365 events, | 362 events, |
| 366 recursive).stream; | 363 recursive).stream; |
| 367 | 364 |
| 368 Future<FileSystemEntity> _delete({bool recursive: false}); | 365 Future<FileSystemEntity> _delete({bool recursive: false}); |
| 369 void _deleteSync({bool recursive: false}); | 366 void _deleteSync({bool recursive: false}); |
| 370 | 367 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 } | 701 } |
| 705 } | 702 } |
| 706 | 703 |
| 707 | 704 |
| 708 abstract class _FileSystemWatcher { | 705 abstract class _FileSystemWatcher { |
| 709 external factory _FileSystemWatcher(String path, int events, bool recursive); | 706 external factory _FileSystemWatcher(String path, int events, bool recursive); |
| 710 external static bool get isSupported; | 707 external static bool get isSupported; |
| 711 | 708 |
| 712 Stream<FileSystemEvent> get stream; | 709 Stream<FileSystemEvent> get stream; |
| 713 } | 710 } |
| OLD | NEW |