Workarround to MS ReadDirectoryChanges bug

This is an workaround to deal with Microsoft issue in ReadDirectoryChanges notification
If command prompt is used to write file continuously (e.g. ping -t 8.8.8.8 > ping.log)
Then ReadDirectoryChanges does not detect the change.
The workarround is about using Notepad++ notification while Notepad++ getting focus.

Close #5773
This commit is contained in:
Rajendra Singh 2019-06-12 00:52:02 +05:30 committed by Don HO
parent ad72f7c36c
commit 1a97d3c854
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -1532,6 +1532,17 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_CHECKDOCSTATUS:
{
// This is an workaround to deal with Microsoft issue in ReadDirectoryChanges notification
// If command prompt is used to write file continuously (e.g. ping -t 8.8.8.8 > ping.log)
// Then ReadDirectoryChanges does not detect the change.
// Fortunately, notification is sent if right click or double click happens on that file
// Let's leverage this as workaround to enhance npp file monitoring functionality.
// So calling "PathFileExists" is a workaround here.
Buffer* currBuf = getCurrentBuffer();
if (currBuf && currBuf->isMonitoringOn())
::PathFileExists(currBuf->getFullPathName());
const NppGUI & nppgui = pNppParam->getNppGUI();
if (nppgui._fileAutoDetection != cdDisabled)
{