Chromium Code Reviews| Index: runtime/bin/file_patch.dart |
| diff --git a/runtime/bin/file_patch.dart b/runtime/bin/file_patch.dart |
| index be13c3f742f706cf6441d4fa1f96f44a675c47e3..f8933a44c84bd8510341277a746c4d9bd383f702 100644 |
| --- a/runtime/bin/file_patch.dart |
| +++ b/runtime/bin/file_patch.dart |
| @@ -46,6 +46,8 @@ patch class _FileSystemWatcher { |
| /* patch */ factory _FileSystemWatcher( |
| String path, int events, bool recursive) |
| => new _FileSystemWatcherImpl(path, events, recursive); |
| + |
| + /* patch */ static bool get isSupported => _FileSystemWatcherImpl.isSupported; |
|
kustermann
2013/09/03 15:18:58
Wouldn't it make sense to cache the 'isSupported'
Anders Johnsen
2013/09/03 15:32:56
As this is not performance critical, I'll not cach
|
| } |
| class _FileSystemWatcherImpl |
| @@ -59,6 +61,11 @@ class _FileSystemWatcherImpl |
| StreamSubscription _subscription; |
| _FileSystemWatcherImpl(this._path, this._events, this._recursive) { |
| + if (!isSupported) { |
| + throw new FileException( |
| + "File system watching is not supported on this system", |
| + _path); |
| + } |
| _controller = new StreamController(onListen: _listen, onCancel: _cancel); |
| } |
| @@ -140,6 +147,8 @@ class _FileSystemWatcherImpl |
| Stream<FileSystemEvent> get stream => _controller.stream; |
| + static bool get isSupported native "FileSystemWatcher_IsSupported"; |
| + |
| int _watchPath(String path, int events, bool recursive) |
| native "FileSystemWatcher_WatchPath"; |
| void _unwatchPath() native "FileSystemWatcher_UnwatchPath"; |