Menu

#3 Another fix for the "move" issue on linux

open
nobody
None
5
2010-05-27
2010-05-27
No

The usual way to deal with IN_MOVED_FROM and IN_MOVED_TO signals is as follows:
- If you receive an IN_MOVED_FROM signal, you wait for a small amount of time (half a second should be more than enough since IN_MOVED_FROM and IN_MOVED_TO events are usually emitted consecutively) before doing anything.
- If a matching IN_MOVED_TO signal is received during this duration, a "renamed" event is fired as usual.
- If no IN_MOVED_TO signal is received after the elapsed time, we assume that the file has moved outside the watched directory, ie. it's "deleted".
- If an IN_MOVED_TO signal is received without any matching IN_MOVED_FROM cached entry, we translate it into a create event (actually, a "create" followed by a "modify" in order to accurately emulate a new file creation).

This effect is achieved here by using a java Timer on reception of IN_MOVED_FROM signals (no change done on the native code)... Quite straightforward, but seems to work fine so far, also when watching sub-directories...

Hope this helps...

Discussion

  • Jean Revertera

    Jean Revertera - 2010-05-27

    linux move patch for JNotify 0.93

     
  • Omry Yadan

    Omry Yadan - 2010-07-15

    sounds good conceptually.
    Jean, I am looking for someone that can maintain the linux version of JNotify, are you interested?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.