Fixed windows dirmonitor issues.
This commit is contained in:
parent
562e284d04
commit
974fd9c8d5
|
@ -47,9 +47,9 @@ function dirwatch:watch(directory, bool)
|
||||||
return self:scan(directory)
|
return self:scan(directory)
|
||||||
end
|
end
|
||||||
self.windows_watch_top = target
|
self.windows_watch_top = target
|
||||||
|
end
|
||||||
|
end
|
||||||
self.windows_watch_count = self.windows_watch_count + 1
|
self.windows_watch_count = self.windows_watch_count + 1
|
||||||
end
|
|
||||||
end
|
|
||||||
self.watched[directory] = true
|
self.watched[directory] = true
|
||||||
else
|
else
|
||||||
local value = self.monitor:watch(directory)
|
local value = self.monitor:watch(directory)
|
||||||
|
|
|
@ -70,7 +70,7 @@ static int f_dirmonitor_watch(lua_State *L) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int f_dirmonitor_unwatch(lua_State *L) {
|
static int f_dirmonitor_unwatch(lua_State *L) {
|
||||||
remove_dirmonitor(*(struct dirmonitor**)luaL_checkudata(L, 1, API_TYPE_DIRMONITOR), luaL_checknumber(L, 2));
|
remove_dirmonitor(*(struct dirmonitor**)luaL_checkudata(L, 1, API_TYPE_DIRMONITOR), lua_tonumber(L, 2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
struct dirmonitor {
|
struct dirmonitor {
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
char buffer[8192];
|
char buffer[64512];
|
||||||
OVERLAPPED overlapped;
|
OVERLAPPED overlapped;
|
||||||
bool running;
|
bool running;
|
||||||
};
|
};
|
||||||
|
@ -52,8 +52,8 @@ int check_dirmonitor_win32(struct dirmonitor* monitor, int (*change_callback)(in
|
||||||
|
|
||||||
monitor->running = false;
|
monitor->running = false;
|
||||||
|
|
||||||
for (FILE_NOTIFY_INFORMATION* info = (FILE_NOTIFY_INFORMATION*)monitor->buffer; (char*)info < monitor->buffer + sizeof(monitor->buffer); info = (FILE_NOTIFY_INFORMATION*)((char*)info) + info->NextEntryOffset) {
|
for (FILE_NOTIFY_INFORMATION* info = (FILE_NOTIFY_INFORMATION*)monitor->buffer; (char*)info < monitor->buffer + sizeof(monitor->buffer); info = (FILE_NOTIFY_INFORMATION*)(((char*)info) + info->NextEntryOffset)) {
|
||||||
change_callback(info->FileNameLength, (char*)info->FileName, data);
|
change_callback(info->FileNameLength / sizeof(WCHAR), (char*)info->FileName, data);
|
||||||
if (!info->NextEntryOffset)
|
if (!info->NextEntryOffset)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue