@Bruno-Medeiros
afaik, npp does not actively poll a file for its current state, instead it is using the windows event system to get informed when a file has been updated.
This technique has several advantages like
no ressources will be wasted while monitoring files, you can monitor many files without having
impact on the editor itself etc… but, obviously, has also a disadvantage, that is that the windows
event system doesn’t receive update information on files which aren’t updated in the “correct way” .
The “correct way” means, an application needs to flush the changes or close the file after writing
in order to generate such events.
A simple example using the python script plugin.
Let’s assume you want to monitor a file C:\test_monitoring. Let’s do the the following
We create the file by using
f = open(r'C:\test_monitoring','w')
now let’s open the tile in npp and press monitoring button you should the the following
ok, let’s try to write something to the file like
f.write('this is a test')
and you will see that npp doesn’t get informed about the update.
but once the application which updated the file does a flush or close on that file like
f.flush()
f.close()
the windows event system recognizes this and send the event to npp
As said, simple example because it gets even more complicated when the file to be monitored
is on the network or on an external usb disc or drive.
Cheers
Claudia