B4J Question [jFileWatcher] Creation raises twice

Blueforcer

Active Member
Licensed User
I will track my download folder with jFileWatcher.
But if i download a single file from browser, the CreationDetected Event raises twice.
How can i prevent this?
 

OliverA

Expert
Licensed User
How can i prevent this?
Are you sure you are not getting a creation event for the temp file the browser creates and then another one for the actual file it creates? So you may need to ignore any of the temp files and only act on the actually finished download file.
 

Blueforcer

Active Member
Licensed User
Youre right! unfortunally the filename is the same. so it works if i check the filesize>0 and then start my actions.
Thank you
 

Blueforcer

Active Member
Licensed User
It also seems that modify a file, raises the ModificationDetected event very often depending on the editor.
I modify a txt file with Visual Studio code. save it and the event raises 2-4 times. it does not happen with the windows editor
Is there a way to delay the detection or something like this?
 

OliverA

Expert
Licensed User
You could try keeping track of time. Once an event is raised, enable a timer (say 30 seconds or more, depending how often the events happen). If something happens during that time, reset the timer. If the timer activates, treat the event as occurred. It’s not a perfect solution, since it introduces a delay, but it may be a workaround for your situation.
 
Top