OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 patch class _File { | 5 patch class _File { |
6 /* patch */ static _exists(String path) native "File_Exists"; | 6 /* patch */ static _exists(String path) native "File_Exists"; |
7 /* patch */ static _create(String path) native "File_Create"; | 7 /* patch */ static _create(String path) native "File_Create"; |
8 /* patch */ static _createLink(String path, String target) | 8 /* patch */ static _createLink(String path, String target) |
9 native "File_CreateLink"; | 9 native "File_CreateLink"; |
10 /* patch */ static _linkTarget(String path) native "File_LinkTarget"; | 10 /* patch */ static _linkTarget(String path) native "File_LinkTarget"; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 StreamController _controller; | 55 StreamController _controller; |
56 StreamSubscription _subscription; | 56 StreamSubscription _subscription; |
57 | 57 |
58 _FileSystemWatcherImpl(this._path, this._events, this._recursive) { | 58 _FileSystemWatcherImpl(this._path, this._events, this._recursive) { |
59 if (!isSupported) { | 59 if (!isSupported) { |
60 throw new FileSystemException( | 60 throw new FileSystemException( |
61 "File system watching is not supported on this system", | 61 "File system watching is not supported on this system", |
62 _path); | 62 _path); |
63 } | 63 } |
64 _controller = new StreamController(onListen: _listen, onCancel: _cancel); | 64 _controller = new StreamController.broadcast(onListen: _listen, |
| 65 onCancel: _cancel); |
65 } | 66 } |
66 | 67 |
67 void _listen() { | 68 void _listen() { |
68 int socketId; | 69 int socketId; |
69 try { | 70 try { |
70 socketId = _watchPath(_path, _events, identical(true, _recursive)); | 71 socketId = _watchPath(_path, _events, identical(true, _recursive)); |
71 } catch (e) { | 72 } catch (e) { |
72 throw new FileSystemException( | 73 throw new FileSystemException( |
73 "Failed to watch path", | 74 "Failed to watch path", |
74 _path, | 75 _path, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 158 |
158 int _watchPath(String path, int events, bool recursive) | 159 int _watchPath(String path, int events, bool recursive) |
159 native "FileSystemWatcher_WatchPath"; | 160 native "FileSystemWatcher_WatchPath"; |
160 void _unwatchPath() native "FileSystemWatcher_UnwatchPath"; | 161 void _unwatchPath() native "FileSystemWatcher_UnwatchPath"; |
161 List _readEvents() native "FileSystemWatcher_ReadEvents"; | 162 List _readEvents() native "FileSystemWatcher_ReadEvents"; |
162 } | 163 } |
163 | 164 |
164 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { | 165 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { |
165 return new Uint8List.view(source.buffer, offsetInBytes, length); | 166 return new Uint8List.view(source.buffer, offsetInBytes, length); |
166 } | 167 } |
OLD | NEW |