Menu

#16 rename folder on Mac OS X

0.94
pending-accepted
Mac OS X (5)
5
2012-04-22
2011-11-02
dvd23
No

Hello,

when I rename a folder on Mac OS X, i have a rename event (that's good), but when I modify a file in this folder after that, I have multiple create (one for each file in the folder), as if those file were not watched.

Can you help me with that?

Thanks,
David

Discussion

  • Matthew Donoughe

    Confirmed. I have four or five things ongoing besides work, but I should be able to get to this.

    You should be getting deletion events in the same batch as that rename event. They'll come first because it's impossible to tell the exact ordering of the events and deletes get reported before renames(just the way I coded it).

    Scanning the new folder after a rename should cause rename events to fire for all the files contained in the folder, which I'm not sure is a good thing. Do you know what happens on Windows or Linux? It would definitely make JNotify easier to work with if an event was fired for each file, but it would also potentially create a very large number of events for a single operation. Either way doesn't seem too hard to implement.

     
  • dvd23

    dvd23 - 2011-11-13

    No problems.

    In the mean time I just modified line 362 of JNotifyAdapterMacOSX from
    if (watchSubtree && recursive && files[i].isDirectory())
    to
    if ((watchSubtree && recursive && files[i].isDirectory()) || (watchSubtree && files[i].isDirectory() && events.created.containsKey(jnf)))

    So that when a folder is renamed, it is directly recursively rescanned if needed.
    With that I avoid having "created" events when I modify a file in that folder.

    Anyway, thanks for the good work, keep it up!
    If I can do something to help, I would be really glad (I'm a java developer).

    David.

     
  • Matthew Donoughe

    • labels: --> Mac OS X
    • milestone: --> 0.94
    • assigned_to: nobody --> mdonoughe
    • status: open --> open-accepted
     
  • Matthew Donoughe

    • status: open-accepted --> pending-accepted
     

Log in to post a comment.