Skip to content

Commit

Permalink
Fix old windows versions not initializing the watcher.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpartanJ committed Sep 18, 2024
1 parent aa4b29e commit 0079548
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/efsw/WatcherWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void initReadDirectoryChangesEx() {
if ( !hModule )
return;

pReadDirectoryChangesExW =
pReadDirectoryChangesExW =
(EFSW_LPREADDIRECTORYCHANGESEXW)GetProcAddress( hModule, "ReadDirectoryChangesExW" );
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ void CALLBACK WatchCallback( DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOve
/// Refreshes the directory monitoring.
RefreshResult RefreshWatch( WatcherStructWin32* pWatch ) {
initReadDirectoryChangesEx();

bool bRet = false;
RefreshResult ret = RefreshResult::Failed;
pWatch->Watch->Extended = false;
Expand All @@ -198,7 +198,7 @@ RefreshResult RefreshWatch( WatcherStructWin32* pWatch ) {
pWatch->Watch->Extended = true;
}
}

if ( !bRet ) {
bRet = ReadDirectoryChangesW( pWatch->Watch->DirHandle, pWatch->Watch->Buffer.data(),
(DWORD)pWatch->Watch->Buffer.size(), pWatch->Watch->Recursive,
Expand Down Expand Up @@ -247,7 +247,7 @@ WatcherStructWin32* CreateWatch( LPCWSTR szDirectory, bool recursive,
pWatch->NotifyFilter = notifyFilter;
pWatch->Recursive = recursive;

if ( RefreshWatch( tWatch ) ) {
if ( RefreshResult::Failed != RefreshWatch( tWatch ) ) {
return tWatch;
}
}
Expand Down

0 comments on commit 0079548

Please sign in to comment.