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...
linux move patch for JNotify 0.93
sounds good conceptually.
Jean, I am looking for someone that can maintain the linux version of JNotify, are you interested?