1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

B4J Question [jFileWatcher] Creation raises twice

Discussion in 'B4J Questions' started by Blueforcer, Aug 28, 2019.

  1. Blueforcer

    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?
     
  2. OliverA

    OliverA Expert Licensed User

    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.
     
  3. Blueforcer

    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
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Moved to the questions forum.
     
  5. Blueforcer

    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?
     
  6. OliverA

    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice