OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "bin/file_system_watcher.h" | 8 #include "bin/file_system_watcher.h" |
9 #include "bin/eventhandler.h" | 9 #include "bin/eventhandler.h" |
10 | 10 |
11 #include <WinIoCtl.h> // NOLINT | 11 #include <WinIoCtl.h> // NOLINT |
12 | 12 |
13 #include "bin/builtin.h" | 13 #include "bin/builtin.h" |
14 #include "bin/log.h" | 14 #include "bin/log.h" |
15 #include "bin/utils.h" | 15 #include "bin/utils.h" |
| 16 #include "bin/utils_win.h" |
16 | 17 |
17 | 18 |
18 namespace dart { | 19 namespace dart { |
19 namespace bin { | 20 namespace bin { |
20 | 21 |
21 bool FileSystemWatcher::IsSupported() { | 22 bool FileSystemWatcher::IsSupported() { |
22 return true; | 23 return true; |
23 } | 24 } |
24 | 25 |
25 | 26 |
26 intptr_t FileSystemWatcher::Init() { | 27 intptr_t FileSystemWatcher::Init() { |
27 return 0; | 28 return 0; |
28 } | 29 } |
29 | 30 |
30 | 31 |
31 void FileSystemWatcher::Close(intptr_t id) { | 32 void FileSystemWatcher::Close(intptr_t id) { |
32 USE(id); | 33 USE(id); |
33 } | 34 } |
34 | 35 |
35 | 36 |
36 intptr_t FileSystemWatcher::WatchPath(intptr_t id, | 37 intptr_t FileSystemWatcher::WatchPath(intptr_t id, |
37 const char* path, | 38 const char* path, |
38 int events, | 39 int events, |
39 bool recursive) { | 40 bool recursive) { |
40 USE(id); | 41 USE(id); |
41 const wchar_t* name = StringUtils::Utf8ToWide(path); | 42 const wchar_t* name = StringUtilsWin::Utf8ToWide(path); |
42 HANDLE dir = CreateFileW(name, | 43 HANDLE dir = CreateFileW(name, |
43 FILE_LIST_DIRECTORY, | 44 FILE_LIST_DIRECTORY, |
44 FILE_SHARE_READ | | 45 FILE_SHARE_READ | |
45 FILE_SHARE_WRITE | | 46 FILE_SHARE_WRITE | |
46 FILE_SHARE_DELETE, | 47 FILE_SHARE_DELETE, |
47 NULL, | 48 NULL, |
48 OPEN_EXISTING, | 49 OPEN_EXISTING, |
49 FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, | 50 FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, |
50 NULL); | 51 NULL); |
51 free(const_cast<wchar_t*>(name)); | 52 free(const_cast<wchar_t*>(name)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 offset += e->NextEntryOffset; | 121 offset += e->NextEntryOffset; |
121 } | 122 } |
122 delete[] buffer; | 123 delete[] buffer; |
123 return events; | 124 return events; |
124 } | 125 } |
125 | 126 |
126 } // namespace bin | 127 } // namespace bin |
127 } // namespace dart | 128 } // namespace dart |
128 | 129 |
129 #endif // defined(TARGET_OS_WINDOWS) | 130 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |