shama / navelgazer

:tangerine::crystal_ball: A super fast, light weight, simple file watcher and platform layer for gaze.
MIT License
21 stars 1 forks source link

Support rename event for linux #2

Open shama opened 10 years ago

shama commented 10 years ago

Not likely going to happen easily as inotify will only give you the path of a file associated with the event.

Meaning a IN_MOVE_SELF will give us the path that was moved but not where it was moved to. IN_MOVED_TO will tell us if a file was moved into a watched folder (and a good potential candidate to discern the path a previous watched file was moved to) but it doesn't tell us where it was moved from.

The branch exp-linux-rename is an attempt to treat those events in combination as a rename but the tests are flakey with it: https://github.com/shama/navelgazer/commit/008336de8d722f176ce73873bb938ef25c3a1dc9

joshperry commented 9 years ago

Rename events can be synthesized using the IN_MOVED_FROM and IN_MOVED_TO events in combination with the cookie value that is attached to those events.

See the discussion on the inotify manpage and also the article I linked in #14.