Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1155)

Unified Diff: pkg/watcher/lib/src/directory_watcher.dart

Issue 313743004: Fall back to PollingDirectoryWatcher if FileSystemEntity:watch is not supported. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/watcher/lib/src/directory_watcher.dart
diff --git a/pkg/watcher/lib/src/directory_watcher.dart b/pkg/watcher/lib/src/directory_watcher.dart
index 27dbb3f5101f56e5bcb8fa08f5b2d4a177362676..605eaea48f95dc4ca62364234dc3ee5275000280 100644
--- a/pkg/watcher/lib/src/directory_watcher.dart
+++ b/pkg/watcher/lib/src/directory_watcher.dart
@@ -55,9 +55,11 @@ abstract class DirectoryWatcher {
/// and higher CPU usage. Defaults to one second. Ignored for non-polling
/// watchers.
factory DirectoryWatcher(String directory, {Duration pollingDelay}) {
- if (Platform.isLinux) return new LinuxDirectoryWatcher(directory);
- if (Platform.isMacOS) return new MacOSDirectoryWatcher(directory);
- if (Platform.isWindows) return new WindowsDirectoryWatcher(directory);
+ if (FileSystemEntity.isWatchSupported) {
+ if (Platform.isLinux) return new LinuxDirectoryWatcher(directory);
+ if (Platform.isMacOS) return new MacOSDirectoryWatcher(directory);
+ if (Platform.isWindows) return new WindowsDirectoryWatcher(directory);
+ }
return new PollingDirectoryWatcher(directory, pollingDelay: pollingDelay);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698