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"; |
11 /* @patch */ static _deleteNative(String path) native "File_Delete"; | 11 @patch static _deleteNative(String path) native "File_Delete"; |
12 /* @patch */ static _deleteLinkNative(String path) native "File_DeleteLink"; | 12 @patch static _deleteLinkNative(String path) native "File_DeleteLink"; |
13 /* @patch */ static _rename(String oldPath, String newPath) | 13 @patch static _rename(String oldPath, String newPath) |
14 native "File_Rename"; | 14 native "File_Rename"; |
15 /* @patch */ static _renameLink(String oldPath, String newPath) | 15 @patch static _renameLink(String oldPath, String newPath) |
16 native "File_RenameLink"; | 16 native "File_RenameLink"; |
17 /* @patch */ static _copy(String oldPath, String newPath) native "File_Copy"; | 17 @patch static _copy(String oldPath, String newPath) native "File_Copy"; |
18 /* @patch */ static _lengthFromPath(String path) native "File_LengthFromPath"; | 18 @patch static _lengthFromPath(String path) native "File_LengthFromPath"; |
19 /* @patch */ static _lastModified(String path) native "File_LastModified"; | 19 @patch static _lastModified(String path) native "File_LastModified"; |
20 /* @patch */ static _open(String path, int mode) native "File_Open"; | 20 @patch static _open(String path, int mode) native "File_Open"; |
21 /* @patch */ static int _openStdio(int fd) native "File_OpenStdio"; | 21 @patch static int _openStdio(int fd) native "File_OpenStdio"; |
22 } | 22 } |
23 | 23 |
24 | 24 |
25 @patch class _RandomAccessFileOps { | 25 @patch class _RandomAccessFileOps { |
26 /* @patch */ factory _RandomAccessFileOps(int pointer) | 26 @patch factory _RandomAccessFileOps(int pointer) |
27 => new _RandomAccessFileOpsImpl(pointer); | 27 => new _RandomAccessFileOpsImpl(pointer); |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 class _RandomAccessFileOpsImpl extends NativeFieldWrapperClass1 | 31 class _RandomAccessFileOpsImpl extends NativeFieldWrapperClass1 |
32 implements _RandomAccessFileOps { | 32 implements _RandomAccessFileOps { |
33 _RandomAccessFileOpsImpl._(); | 33 _RandomAccessFileOpsImpl._(); |
34 | 34 |
35 factory _RandomAccessFileOpsImpl(int pointer) | 35 factory _RandomAccessFileOpsImpl(int pointer) |
36 => new _RandomAccessFileOpsImpl._().._setPointer(pointer); | 36 => new _RandomAccessFileOpsImpl._().._setPointer(pointer); |
(...skipping 30 matching lines...) Expand all Loading... |
67 static final Map<int, _WatcherPath> _idMap = {}; | 67 static final Map<int, _WatcherPath> _idMap = {}; |
68 | 68 |
69 final String _path; | 69 final String _path; |
70 final int _events; | 70 final int _events; |
71 final bool _recursive; | 71 final bool _recursive; |
72 | 72 |
73 _WatcherPath _watcherPath; | 73 _WatcherPath _watcherPath; |
74 | 74 |
75 StreamController _broadcastController; | 75 StreamController _broadcastController; |
76 | 76 |
77 /* @patch */ static Stream<FileSystemEvent> _watch( | 77 @patch static Stream<FileSystemEvent> _watch( |
78 String path, int events, bool recursive) { | 78 String path, int events, bool recursive) { |
79 if (Platform.isLinux) { | 79 if (Platform.isLinux) { |
80 return new _InotifyFileSystemWatcher(path, events, recursive).stream; | 80 return new _InotifyFileSystemWatcher(path, events, recursive).stream; |
81 } | 81 } |
82 if (Platform.isWindows) { | 82 if (Platform.isWindows) { |
83 return new _Win32FileSystemWatcher(path, events, recursive).stream; | 83 return new _Win32FileSystemWatcher(path, events, recursive).stream; |
84 } | 84 } |
85 if (Platform.isMacOS) { | 85 if (Platform.isMacOS) { |
86 return new _FSEventStreamFileSystemWatcher( | 86 return new _FSEventStreamFileSystemWatcher( |
87 path, events, recursive).stream; | 87 path, events, recursive).stream; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } else if (event == RawSocketEvent.CLOSED) { | 255 } else if (event == RawSocketEvent.CLOSED) { |
256 } else if (event == RawSocketEvent.READ_CLOSED) { | 256 } else if (event == RawSocketEvent.READ_CLOSED) { |
257 } else { | 257 } else { |
258 assert(false); | 258 assert(false); |
259 } | 259 } |
260 events.addAll(stops); | 260 events.addAll(stops); |
261 return events; | 261 return events; |
262 }); | 262 }); |
263 } | 263 } |
264 | 264 |
265 /* @patch */ static bool get isSupported | 265 @patch static bool get isSupported |
266 native "FileSystemWatcher_IsSupported"; | 266 native "FileSystemWatcher_IsSupported"; |
267 | 267 |
268 static int _initWatcher() native "FileSystemWatcher_InitWatcher"; | 268 static int _initWatcher() native "FileSystemWatcher_InitWatcher"; |
269 static void _closeWatcher(int id) native "FileSystemWatcher_CloseWatcher"; | 269 static void _closeWatcher(int id) native "FileSystemWatcher_CloseWatcher"; |
270 | 270 |
271 static int _watchPath(int id, String path, int events, bool recursive) | 271 static int _watchPath(int id, String path, int events, bool recursive) |
272 native "FileSystemWatcher_WatchPath"; | 272 native "FileSystemWatcher_WatchPath"; |
273 static void _unwatchPath(int id, int path_id) | 273 static void _unwatchPath(int id, int path_id) |
274 native "FileSystemWatcher_UnwatchPath"; | 274 native "FileSystemWatcher_UnwatchPath"; |
275 static List _readEvents(int id, int path_id) | 275 static List _readEvents(int id, int path_id) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 void _pathWatchedEnd() { | 375 void _pathWatchedEnd() { |
376 _subscription.cancel(); | 376 _subscription.cancel(); |
377 _controller.close(); | 377 _controller.close(); |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 | 381 |
382 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { | 382 Uint8List _makeUint8ListView(Uint8List source, int offsetInBytes, int length) { |
383 return new Uint8List.view(source.buffer, offsetInBytes, length); | 383 return new Uint8List.view(source.buffer, offsetInBytes, length); |
384 } | 384 } |
OLD | NEW |