Move files, rename classes: "MacOS" watcher is used on Windows too. (#2274)
diff --git a/pkgs/watcher/lib/src/directory_watcher.dart b/pkgs/watcher/lib/src/directory_watcher.dart index c7b341e..9e46ea1 100644 --- a/pkgs/watcher/lib/src/directory_watcher.dart +++ b/pkgs/watcher/lib/src/directory_watcher.dart
@@ -6,9 +6,8 @@ import '../watcher.dart'; import 'custom_watcher_factory.dart'; -import 'directory_watcher/linux.dart'; -import 'directory_watcher/macos.dart'; -import 'directory_watcher/windows_resubscribable_watcher.dart'; +import 'directory_watcher/linux/linux_directory_watcher.dart'; +import 'directory_watcher/recursive/recursive_directory_watcher.dart'; /// Watches the contents of a directory and emits [WatchEvent]s when something /// in the directory has changed. @@ -52,9 +51,11 @@ ); if (customWatcher != null) return customWatcher; if (Platform.isLinux) return LinuxDirectoryWatcher(directory); - if (Platform.isMacOS) return MacosDirectoryWatcher(directory); + if (Platform.isMacOS) { + return RecursiveDirectoryWatcher(directory, runInIsolate: false); + } if (Platform.isWindows) { - return WindowsDirectoryWatcher(directory, + return RecursiveDirectoryWatcher(directory, runInIsolate: runInIsolateOnWindows); } }
diff --git a/pkgs/watcher/lib/src/directory_watcher/linux.dart b/pkgs/watcher/lib/src/directory_watcher/linux/linux_directory_watcher.dart similarity index 90% rename from pkgs/watcher/lib/src/directory_watcher/linux.dart rename to pkgs/watcher/lib/src/directory_watcher/linux/linux_directory_watcher.dart index baee22c..eb93cc2 100644 --- a/pkgs/watcher/lib/src/directory_watcher/linux.dart +++ b/pkgs/watcher/lib/src/directory_watcher/linux/linux_directory_watcher.dart
@@ -4,10 +4,10 @@ import 'dart:async'; -import '../directory_watcher.dart'; -import '../resubscribable.dart'; -import '../watch_event.dart'; -import 'linux/watch_tree_root.dart'; +import '../../directory_watcher.dart'; +import '../../resubscribable.dart'; +import '../../watch_event.dart'; +import 'watch_tree_root.dart'; /// Resubscribable Linux directory watcher that watches using /// [_LinuxDirectoryWatcher].
diff --git a/pkgs/watcher/lib/src/directory_watcher/macos.dart b/pkgs/watcher/lib/src/directory_watcher/macos.dart deleted file mode 100644 index 0cfceb2..0000000 --- a/pkgs/watcher/lib/src/directory_watcher/macos.dart +++ /dev/null
@@ -1,53 +0,0 @@ -// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:async'; - -import '../directory_watcher.dart'; -import '../resubscribable.dart'; -import '../watch_event.dart'; -import 'macos/watched_directory_tree.dart'; - -/// Resubscribable MacOS directory watcher that watches using -/// [_MacosDirectoryWatcher]. -class MacosDirectoryWatcher extends ResubscribableWatcher - implements DirectoryWatcher { - @override - String get directory => path; - - MacosDirectoryWatcher(String directory) - : super(directory, () => _MacosDirectoryWatcher(directory)); -} - -/// Macos directory watcher that watches using [WatchedDirectoryTree]. -class _MacosDirectoryWatcher - implements DirectoryWatcher, ManuallyClosedWatcher { - @override - final String path; - @override - String get directory => path; - - @override - Stream<WatchEvent> get events => _eventsController.stream; - final _eventsController = StreamController<WatchEvent>(); - - @override - bool get isReady => _readyCompleter.isCompleted; - - @override - Future<void> get ready => _readyCompleter.future; - final _readyCompleter = Completer<void>(); - - late final WatchedDirectoryTree _watchTree; - - _MacosDirectoryWatcher(this.path) { - _watchTree = WatchedDirectoryTree( - watchedDirectory: path, - eventsController: _eventsController, - readyCompleter: _readyCompleter); - } - - @override - void close() => _watchTree.stopWatching(); -}
diff --git a/pkgs/watcher/lib/src/directory_watcher/directory_list.dart b/pkgs/watcher/lib/src/directory_watcher/polling/directory_list.dart similarity index 100% rename from pkgs/watcher/lib/src/directory_watcher/directory_list.dart rename to pkgs/watcher/lib/src/directory_watcher/polling/directory_list.dart
diff --git a/pkgs/watcher/lib/src/directory_watcher/polling.dart b/pkgs/watcher/lib/src/directory_watcher/polling/polling_directory_watcher.dart similarity index 96% rename from pkgs/watcher/lib/src/directory_watcher/polling.dart rename to pkgs/watcher/lib/src/directory_watcher/polling/polling_directory_watcher.dart index 3690761..835a0b5 100644 --- a/pkgs/watcher/lib/src/directory_watcher/polling.dart +++ b/pkgs/watcher/lib/src/directory_watcher/polling/polling_directory_watcher.dart
@@ -5,11 +5,11 @@ import 'dart:async'; import 'dart:io'; -import '../async_queue.dart'; -import '../directory_watcher.dart'; -import '../polling.dart'; -import '../resubscribable.dart'; -import '../watch_event.dart'; +import '../../async_queue.dart'; +import '../../directory_watcher.dart'; +import '../../polling.dart'; +import '../../resubscribable.dart'; +import '../../watch_event.dart'; import 'directory_list.dart'; /// Periodically polls a directory for changes.
diff --git a/pkgs/watcher/lib/src/directory_watcher/macos/directory_tree.dart b/pkgs/watcher/lib/src/directory_watcher/recursive/directory_tree.dart similarity index 99% rename from pkgs/watcher/lib/src/directory_watcher/macos/directory_tree.dart rename to pkgs/watcher/lib/src/directory_watcher/recursive/directory_tree.dart index ee78530..5a8e460 100644 --- a/pkgs/watcher/lib/src/directory_watcher/macos/directory_tree.dart +++ b/pkgs/watcher/lib/src/directory_watcher/recursive/directory_tree.dart
@@ -7,7 +7,7 @@ import '../../paths.dart'; import '../../testing.dart'; import '../../watch_event.dart'; -import '../event_tree.dart'; +import 'event_tree.dart'; /// MacOS or Windows directory tree. ///
diff --git a/pkgs/watcher/lib/src/directory_watcher/event_tree.dart b/pkgs/watcher/lib/src/directory_watcher/recursive/event_tree.dart similarity index 98% rename from pkgs/watcher/lib/src/directory_watcher/event_tree.dart rename to pkgs/watcher/lib/src/directory_watcher/recursive/event_tree.dart index 5ea883a..4a8cbee 100644 --- a/pkgs/watcher/lib/src/directory_watcher/event_tree.dart +++ b/pkgs/watcher/lib/src/directory_watcher/recursive/event_tree.dart
@@ -2,7 +2,7 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -import '../paths.dart'; +import '../../paths.dart'; /// Tree of event paths relative to the watched path. ///
diff --git a/pkgs/watcher/lib/src/directory_watcher/windows_isolate_directory_watcher.dart b/pkgs/watcher/lib/src/directory_watcher/recursive/isolate_recursive_directory_watcher.dart similarity index 91% rename from pkgs/watcher/lib/src/directory_watcher/windows_isolate_directory_watcher.dart rename to pkgs/watcher/lib/src/directory_watcher/recursive/isolate_recursive_directory_watcher.dart index ab2b5b0..736ea68 100644 --- a/pkgs/watcher/lib/src/directory_watcher/windows_isolate_directory_watcher.dart +++ b/pkgs/watcher/lib/src/directory_watcher/recursive/isolate_recursive_directory_watcher.dart
@@ -5,12 +5,12 @@ import 'dart:async'; import 'dart:isolate'; -import '../resubscribable.dart'; -import '../testing.dart'; -import '../watch_event.dart'; -import 'windows.dart'; +import '../../resubscribable.dart'; +import '../../testing.dart'; +import '../../watch_event.dart'; +import 'recursive_directory_watcher.dart'; -/// Runs [WindowsManuallyClosedDirectoryWatcher] in an isolate to work around +/// Runs [ManuallyClosedRecursiveDirectoryWatcher] in an isolate to work around /// a platform limitation. /// /// On Windows, Directory.watch fails if too many events arrive without being @@ -21,7 +21,7 @@ /// Running the watcher in an isolate makes buffer exhaustion much less likely /// as there is no unrelated work happening in the isolate that would block /// processing of events. -class WindowsIsolateDirectoryWatcher implements ManuallyClosedWatcher { +class IsolateRecursiveDirectoryWatcher implements ManuallyClosedWatcher { @override final String path; final ReceivePort _receivePort = ReceivePort(); @@ -33,7 +33,7 @@ final void Function(LogEntry)? _log; - WindowsIsolateDirectoryWatcher(this.path) + IsolateRecursiveDirectoryWatcher(this.path) : _log = logSeparateIsolateForTesting { _startIsolate(path, _receivePort.sendPort, log: _log != null); _receivePort.listen((event) => _receiveFromIsolate(event as Event)); @@ -87,7 +87,7 @@ class _WatcherIsolate { final String path; - final WindowsManuallyClosedDirectoryWatcher watcher; + final ManuallyClosedRecursiveDirectoryWatcher watcher; final SendPort sendPort; final bool log; @@ -96,7 +96,7 @@ final Completer<void> _closeCompleter = Completer(); _WatcherIsolate(this.path, this.sendPort, {required this.log}) - : watcher = WindowsManuallyClosedDirectoryWatcher(path) { + : watcher = ManuallyClosedRecursiveDirectoryWatcher(path) { if (log) { logForTesting = (message) => sendPort.send(Event.log(message)); }
diff --git a/pkgs/watcher/lib/src/directory_watcher/recursive/recursive_directory_watcher.dart b/pkgs/watcher/lib/src/directory_watcher/recursive/recursive_directory_watcher.dart new file mode 100644 index 0000000..3971f34 --- /dev/null +++ b/pkgs/watcher/lib/src/directory_watcher/recursive/recursive_directory_watcher.dart
@@ -0,0 +1,63 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:async'; + +import '../../directory_watcher.dart'; +import '../../resubscribable.dart'; +import '../../watch_event.dart'; +import 'isolate_recursive_directory_watcher.dart'; +import 'watched_directory_tree.dart'; + +/// Directory watcher that watches using [WatchedDirectoryTree]. +/// +/// Optionally, runs the watcher in a new isolate. +class RecursiveDirectoryWatcher extends ResubscribableWatcher + implements DirectoryWatcher { + @override + String get directory => path; + + /// Watches [directory]. + /// + /// If [runInIsolate], runs the watcher in an isolate to reduce the chance of + /// hitting the Windows-specific buffer exhaustion failure. + RecursiveDirectoryWatcher(String directory, {required bool runInIsolate}) + : super( + directory, + () => runInIsolate + ? IsolateRecursiveDirectoryWatcher(directory) + : ManuallyClosedRecursiveDirectoryWatcher(directory)); +} + +/// Manually closed directory watcher that watches using [WatchedDirectoryTree]. +class ManuallyClosedRecursiveDirectoryWatcher + implements DirectoryWatcher, ManuallyClosedWatcher { + @override + final String path; + @override + String get directory => path; + + @override + Stream<WatchEvent> get events => _eventsController.stream; + final _eventsController = StreamController<WatchEvent>(); + + @override + bool get isReady => _readyCompleter.isCompleted; + + @override + Future<void> get ready => _readyCompleter.future; + final _readyCompleter = Completer<void>(); + + late final WatchedDirectoryTree _watchTree; + + ManuallyClosedRecursiveDirectoryWatcher(this.path) { + _watchTree = WatchedDirectoryTree( + watchedDirectory: path, + eventsController: _eventsController, + readyCompleter: _readyCompleter); + } + + @override + void close() => _watchTree.stopWatching(); +}
diff --git a/pkgs/watcher/lib/src/directory_watcher/macos/native_watch.dart b/pkgs/watcher/lib/src/directory_watcher/recursive/recursive_native_watch.dart similarity index 97% rename from pkgs/watcher/lib/src/directory_watcher/macos/native_watch.dart rename to pkgs/watcher/lib/src/directory_watcher/recursive/recursive_native_watch.dart index d267171..15fd824 100644 --- a/pkgs/watcher/lib/src/directory_watcher/macos/native_watch.dart +++ b/pkgs/watcher/lib/src/directory_watcher/recursive/recursive_native_watch.dart
@@ -9,9 +9,10 @@ import '../../event_batching.dart'; import '../../paths.dart'; import '../../testing.dart'; -import '../event_tree.dart'; +import 'event_tree.dart'; -/// Recursively watches a directory with `Directory.watch` on MacOS or Windows. +/// Watches a directory with `Directory.watch(recursive: true)` on MacOS or +/// Windows. /// /// Handles incorrect closure of the watch due to a delete event from before /// the watch started, by re-opening the watch if the directory still exists. @@ -19,7 +20,7 @@ /// /// Handles deletion of the watched directory on Windows by watching the parent /// directory. -class NativeWatch { +class RecursiveNativeWatch { final AbsolutePath watchedDirectory; /// Called when [watchedDirectory] is recreated. @@ -43,7 +44,7 @@ /// Watches [watchedDirectory]. /// /// Pass [watchedDirectoryWasDeleted], [onEvents] and [onError] handlers. - NativeWatch({ + RecursiveNativeWatch({ required this.watchedDirectory, required void Function() watchedDirectoryWasRecreated, required void Function() watchedDirectoryWasDeleted,
diff --git a/pkgs/watcher/lib/src/directory_watcher/macos/watched_directory_tree.dart b/pkgs/watcher/lib/src/directory_watcher/recursive/watched_directory_tree.dart similarity index 93% rename from pkgs/watcher/lib/src/directory_watcher/macos/watched_directory_tree.dart rename to pkgs/watcher/lib/src/directory_watcher/recursive/watched_directory_tree.dart index c9f3648..95d3998 100644 --- a/pkgs/watcher/lib/src/directory_watcher/macos/watched_directory_tree.dart +++ b/pkgs/watcher/lib/src/directory_watcher/recursive/watched_directory_tree.dart
@@ -7,13 +7,15 @@ import '../../paths.dart'; import '../../testing.dart'; import '../../watch_event.dart'; -import '../event_tree.dart'; import 'directory_tree.dart'; -import 'native_watch.dart'; +import 'event_tree.dart'; +import 'recursive_native_watch.dart'; -/// MacOS or Windows directory watcher using a [DirectoryTree]. +/// Directory watcher using `Directory.watch(recursive: true)` and +/// [DirectoryTree]. /// -/// Various platform-specific issues are worked around. +/// Recursive watch is available on MacOS and Windows; contains +/// platform-specific workarounds for both. /// /// MacOS events from a native watcher can arrive out of order, including in /// different batches. For example, a modification of `a/1` followed by a @@ -48,7 +50,7 @@ final StreamController<WatchEvent> _eventsController; final Completer<void> _readyCompleter; - late final NativeWatch nativeWatch; + late final RecursiveNativeWatch nativeWatch; late final DirectoryTree directoryTree; WatchedDirectoryTree( @@ -63,7 +65,7 @@ } void _watch() async { - nativeWatch = NativeWatch( + nativeWatch = RecursiveNativeWatch( watchedDirectory: watchedDirectory, watchedDirectoryWasRecreated: _watchedDirectoryWasRecreated, watchedDirectoryWasDeleted: _watchedDirectoryWasDeleted,
diff --git a/pkgs/watcher/lib/src/directory_watcher/windows.dart b/pkgs/watcher/lib/src/directory_watcher/windows.dart deleted file mode 100644 index 113500a..0000000 --- a/pkgs/watcher/lib/src/directory_watcher/windows.dart +++ /dev/null
@@ -1,42 +0,0 @@ -// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:async'; - -import '../directory_watcher.dart'; -import '../resubscribable.dart'; -import '../watch_event.dart'; -import 'macos/watched_directory_tree.dart'; - -/// Windows directory watcher that watches using [WatchedDirectoryTree]. -class WindowsManuallyClosedDirectoryWatcher - implements DirectoryWatcher, ManuallyClosedWatcher { - @override - final String path; - @override - String get directory => path; - - @override - Stream<WatchEvent> get events => _eventsController.stream; - final _eventsController = StreamController<WatchEvent>(); - - @override - bool get isReady => _readyCompleter.isCompleted; - - @override - Future<void> get ready => _readyCompleter.future; - final _readyCompleter = Completer<void>(); - - late final WatchedDirectoryTree _watchTree; - - WindowsManuallyClosedDirectoryWatcher(this.path) { - _watchTree = WatchedDirectoryTree( - watchedDirectory: path, - eventsController: _eventsController, - readyCompleter: _readyCompleter); - } - - @override - void close() => _watchTree.stopWatching(); -}
diff --git a/pkgs/watcher/lib/src/directory_watcher/windows_resubscribable_watcher.dart b/pkgs/watcher/lib/src/directory_watcher/windows_resubscribable_watcher.dart deleted file mode 100644 index bfbd4a5..0000000 --- a/pkgs/watcher/lib/src/directory_watcher/windows_resubscribable_watcher.dart +++ /dev/null
@@ -1,25 +0,0 @@ -// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import '../directory_watcher.dart'; -import '../resubscribable.dart'; -import 'windows.dart'; -import 'windows_isolate_directory_watcher.dart'; - -class WindowsDirectoryWatcher extends ResubscribableWatcher - implements DirectoryWatcher { - @override - String get directory => path; - - /// Watches [directory]. - /// - /// If [runInIsolate], runs the watcher in an isolate to reduce the chance of - /// hitting the Windows-specific buffer exhaustion failure. - WindowsDirectoryWatcher(String directory, {bool runInIsolate = true}) - : super( - directory, - () => runInIsolate - ? WindowsIsolateDirectoryWatcher(directory) - : WindowsManuallyClosedDirectoryWatcher(directory)); -}
diff --git a/pkgs/watcher/lib/watcher.dart b/pkgs/watcher/lib/watcher.dart index 12a5369..178c39c 100644 --- a/pkgs/watcher/lib/watcher.dart +++ b/pkgs/watcher/lib/watcher.dart
@@ -10,7 +10,7 @@ export 'src/custom_watcher_factory.dart' show registerCustomWatcher; export 'src/directory_watcher.dart'; -export 'src/directory_watcher/polling.dart'; +export 'src/directory_watcher/polling/polling_directory_watcher.dart'; export 'src/file_watcher.dart'; export 'src/file_watcher/polling.dart'; export 'src/watch_event.dart';
diff --git a/pkgs/watcher/test/directory_watcher/linux_test.dart b/pkgs/watcher/test/directory_watcher/linux_test.dart index 8c80acc..a6817a2 100644 --- a/pkgs/watcher/test/directory_watcher/linux_test.dart +++ b/pkgs/watcher/test/directory_watcher/linux_test.dart
@@ -6,7 +6,7 @@ library; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/linux.dart'; +import 'package:watcher/src/directory_watcher/linux/linux_directory_watcher.dart'; import 'package:watcher/watcher.dart'; import '../utils.dart';
diff --git a/pkgs/watcher/test/directory_watcher/macos_test.dart b/pkgs/watcher/test/directory_watcher/macos_test.dart index c55d880..56fba5f 100644 --- a/pkgs/watcher/test/directory_watcher/macos_test.dart +++ b/pkgs/watcher/test/directory_watcher/macos_test.dart
@@ -6,7 +6,7 @@ library; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/macos.dart'; +import 'package:watcher/src/directory_watcher/recursive/recursive_directory_watcher.dart'; import 'package:watcher/watcher.dart'; import '../utils.dart'; @@ -15,13 +15,15 @@ import 'link_tests.dart'; void main() { - watcherFactory = MacosDirectoryWatcher.new; + watcherFactory = + (directory) => RecursiveDirectoryWatcher(directory, runInIsolate: false); fileTests(isNative: true); linkTests(isNative: true); endToEndTests(); - test('DirectoryWatcher creates a MacOSDirectoryWatcher on Mac OS', () { - expect(DirectoryWatcher('.'), const TypeMatcher<MacosDirectoryWatcher>()); + test('DirectoryWatcher creates a RecursiveDirectoryWatcher on Mac OS', () { + expect( + DirectoryWatcher('.'), const TypeMatcher<RecursiveDirectoryWatcher>()); }); }
diff --git a/pkgs/watcher/test/directory_watcher/directory_list_test.dart b/pkgs/watcher/test/directory_watcher/polling/directory_list_test.dart similarity index 98% rename from pkgs/watcher/test/directory_watcher/directory_list_test.dart rename to pkgs/watcher/test/directory_watcher/polling/directory_list_test.dart index faaf5d8..9057bfe 100644 --- a/pkgs/watcher/test/directory_watcher/directory_list_test.dart +++ b/pkgs/watcher/test/directory_watcher/polling/directory_list_test.dart
@@ -7,9 +7,9 @@ import 'package:path/path.dart' as p; import 'package:test/test.dart'; import 'package:test_descriptor/test_descriptor.dart' as d; -import 'package:watcher/src/directory_watcher/directory_list.dart'; +import 'package:watcher/src/directory_watcher/polling/directory_list.dart'; -import '../utils.dart'; +import '../../utils.dart'; void main() { group('directory list', () {
diff --git a/pkgs/watcher/test/directory_watcher/event_tree_test.dart b/pkgs/watcher/test/directory_watcher/recursive/event_tree_test.dart similarity index 95% rename from pkgs/watcher/test/directory_watcher/event_tree_test.dart rename to pkgs/watcher/test/directory_watcher/recursive/event_tree_test.dart index 48829f6..69c4625 100644 --- a/pkgs/watcher/test/directory_watcher/event_tree_test.dart +++ b/pkgs/watcher/test/directory_watcher/recursive/event_tree_test.dart
@@ -5,7 +5,7 @@ import 'dart:io'; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/event_tree.dart'; +import 'package:watcher/src/directory_watcher/recursive/event_tree.dart'; import 'package:watcher/src/paths.dart'; final separator = Platform.pathSeparator;
diff --git a/pkgs/watcher/test/directory_watcher/windows_test.dart b/pkgs/watcher/test/directory_watcher/windows_test.dart index 544850c..92a592e 100644 --- a/pkgs/watcher/test/directory_watcher/windows_test.dart +++ b/pkgs/watcher/test/directory_watcher/windows_test.dart
@@ -7,7 +7,7 @@ library; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/windows_resubscribable_watcher.dart'; +import 'package:watcher/src/directory_watcher/recursive/recursive_directory_watcher.dart'; import 'package:watcher/watcher.dart'; import '../utils.dart'; @@ -16,13 +16,15 @@ import 'link_tests.dart'; void main() { - watcherFactory = WindowsDirectoryWatcher.new; + watcherFactory = + (directory) => RecursiveDirectoryWatcher(directory, runInIsolate: true); fileTests(isNative: true); linkTests(isNative: true); endToEndTests(); - test('DirectoryWatcher creates a WindowsDirectoryWatcher on Windows', () { - expect(DirectoryWatcher('.'), const TypeMatcher<WindowsDirectoryWatcher>()); + test('DirectoryWatcher creates a RecursiveDirectoryWatcher on Windows', () { + expect( + DirectoryWatcher('.'), const TypeMatcher<RecursiveDirectoryWatcher>()); }); }
diff --git a/pkgs/watcher/test/no_subscription/linux_test.dart b/pkgs/watcher/test/no_subscription/linux_test.dart index aac0810..eaa81d7 100644 --- a/pkgs/watcher/test/no_subscription/linux_test.dart +++ b/pkgs/watcher/test/no_subscription/linux_test.dart
@@ -6,7 +6,7 @@ library; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/linux.dart'; +import 'package:watcher/src/directory_watcher/linux/linux_directory_watcher.dart'; import '../utils.dart'; import 'shared.dart';
diff --git a/pkgs/watcher/test/no_subscription/macos_test.dart b/pkgs/watcher/test/no_subscription/macos_test.dart index 03f729e..80f3072 100644 --- a/pkgs/watcher/test/no_subscription/macos_test.dart +++ b/pkgs/watcher/test/no_subscription/macos_test.dart
@@ -6,13 +6,14 @@ library; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/macos.dart'; +import 'package:watcher/src/directory_watcher/recursive/recursive_directory_watcher.dart'; import '../utils.dart'; import 'shared.dart'; void main() { - watcherFactory = MacosDirectoryWatcher.new; + watcherFactory = + (directory) => RecursiveDirectoryWatcher(directory, runInIsolate: false); sharedTests(); }
diff --git a/pkgs/watcher/test/no_subscription/windows_test.dart b/pkgs/watcher/test/no_subscription/windows_test.dart index 985aa68..e7a83ac 100644 --- a/pkgs/watcher/test/no_subscription/windows_test.dart +++ b/pkgs/watcher/test/no_subscription/windows_test.dart
@@ -6,13 +6,14 @@ library; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/windows_resubscribable_watcher.dart'; +import 'package:watcher/src/directory_watcher/recursive/recursive_directory_watcher.dart'; import '../utils.dart'; import 'shared.dart'; void main() { - watcherFactory = WindowsDirectoryWatcher.new; + watcherFactory = + (directory) => RecursiveDirectoryWatcher(directory, runInIsolate: true); sharedTests(); }
diff --git a/pkgs/watcher/test/ready/linux_test.dart b/pkgs/watcher/test/ready/linux_test.dart index aac0810..eaa81d7 100644 --- a/pkgs/watcher/test/ready/linux_test.dart +++ b/pkgs/watcher/test/ready/linux_test.dart
@@ -6,7 +6,7 @@ library; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/linux.dart'; +import 'package:watcher/src/directory_watcher/linux/linux_directory_watcher.dart'; import '../utils.dart'; import 'shared.dart';
diff --git a/pkgs/watcher/test/ready/macos_test.dart b/pkgs/watcher/test/ready/macos_test.dart index 03f729e..80f3072 100644 --- a/pkgs/watcher/test/ready/macos_test.dart +++ b/pkgs/watcher/test/ready/macos_test.dart
@@ -6,13 +6,14 @@ library; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/macos.dart'; +import 'package:watcher/src/directory_watcher/recursive/recursive_directory_watcher.dart'; import '../utils.dart'; import 'shared.dart'; void main() { - watcherFactory = MacosDirectoryWatcher.new; + watcherFactory = + (directory) => RecursiveDirectoryWatcher(directory, runInIsolate: false); sharedTests(); }
diff --git a/pkgs/watcher/test/ready/windows_test.dart b/pkgs/watcher/test/ready/windows_test.dart index 985aa68..e7a83ac 100644 --- a/pkgs/watcher/test/ready/windows_test.dart +++ b/pkgs/watcher/test/ready/windows_test.dart
@@ -6,13 +6,14 @@ library; import 'package:test/test.dart'; -import 'package:watcher/src/directory_watcher/windows_resubscribable_watcher.dart'; +import 'package:watcher/src/directory_watcher/recursive/recursive_directory_watcher.dart'; import '../utils.dart'; import 'shared.dart'; void main() { - watcherFactory = WindowsDirectoryWatcher.new; + watcherFactory = + (directory) => RecursiveDirectoryWatcher(directory, runInIsolate: true); sharedTests(); }