Skip to content

Commit

Permalink
ReadDirectoryChangesExW is only supported in recent windows.
Browse files Browse the repository at this point in the history
Also break mingw builds it seems.
  • Loading branch information
bakpakin committed Aug 17, 2024
1 parent 42f6af4 commit 3c0c222
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/core/filewatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,14 @@ typedef struct {
} OverlappedWatch;

static void read_dir_changes(OverlappedWatch *ow) {
BOOL result = ReadDirectoryChangesExW(ow->stream->handle,
(FILE_NOTIFY_EXTENDED_INFORMATION *) ow->buf,
BOOL result = ReadDirectoryChangesW(ow->stream->handle,
(FILE_NOTIFY_INFORMATION *) ow->buf,
FILE_INFO_PADDING,
TRUE,
ow->flags,
NULL,
(OVERLAPPED *) ow,
NULL,
ReadDirectoryNotifyExtendedInformation);
NULL);
if (!result) {
janet_panicv(janet_ev_lasterr());
}
Expand Down Expand Up @@ -350,7 +349,7 @@ static void watcher_callback_read(JanetFiber *fiber, JanetAsyncEvent event) {
break;
case JANET_ASYNC_EVENT_COMPLETE:
{
FILE_NOTIFY_EXTENDED_INFORMATION *fni = (FILE_NOTIFY_EXTENDED_INFORMATION *) ow->buf;
FILE_NOTIFY_INFORMATION *fni = (FILE_NOTIFY_INFORMATION *) ow->buf;

while (1) {
/* Got an event */
Expand All @@ -369,7 +368,7 @@ static void watcher_callback_read(JanetFiber *fiber, JanetAsyncEvent event) {

/* Next event */
if (!fni->NextEntryOffset) break;
fni = (FILE_NOTIFY_EXTENDED_INFORMATION *) ((char *)fni + fni->NextEntryOffset);
fni = (FILE_NOTIFY_INFORMATION *) ((char *)fni + fni->NextEntryOffset);
}

/* Make another call to read directory changes */
Expand Down

0 comments on commit 3c0c222

Please sign in to comment.