shama / gaze

:crystal_ball: A globbing fs.watch wrapper built from the best parts of other fine watch libs.
MIT License
1.15k stars 168 forks source link

Everything goes wrong after 'renamed' #107

Open novli opened 10 years ago

novli commented 10 years ago

Windows 7. 0.6.4. Pathwatcher. I use gaze with gulp-watch. Coffee:

...
.gaze
  .on 'changed', (path) ->
    console.log 'Changed: '+path
  .on 'added', (path) ->
    console.log 'Added: '+path
  .on 'deleted', (path) ->
    console.log 'Deleted: '+path
  .on 'renamed', (newPath, oldPath) ->
    console.log 'New: '+newPath
    console.log 'Old: '+oldPath

When I rename a watched file, I see this:

New: D:\Test\Dir\New.ext
Old: D:\Test\Dir\Old.ext
[gulp] New.ext was renamed
Changed: D:\Test\Dir\Old.ext
[gulp] Old.ext was changed

If I change the New.ext contents, I see this:

Changed: D:\Test\Dir\Old.ext
[gulp] Old.ext was changed

If I rename New.ext to Newer.ext, I see this:

New: D:\Test\Dir\Newer.ext
Old: D:\Test\Dir\Old.ext
[gulp] Newer.ext was renamed
Changed: D:\Test\Dir\Old.ext
[gulp] Old.ext was changed

gulp-watch even created New.ext and Newer.ext files as it was expected, but the change of New.ext wrote to nowhere. It seems like 'rename' keeps the old path of the watched file instead of the new one.

If I disable Pathwatcher, everything works fine.

jeanlauliac commented 10 years ago

I confirm the issue, directly using gaze, on OS X 10.9. For example, with the README.md example, on the `all' event, in the case of soft file removal (moving to trash):

src/foo.coffee was added
src/foo.coffee was changed
../../../../.Trash/foo.coffee was renamed
src/foo.coffee was added

And then, it won't generate any more event ever for this specific file, when it is changed anew.

callumlocke commented 10 years ago

Is there any progress on this? The problem described by @jeanlauliac (reporting 'deleted' as 'renamed' on Mac OS X) is a major bug. Is there an old version I can use instead that doesn't have the 'renamed' bug?

shama commented 10 years ago

Feel free to use gaze@0.5.x atm if this is a major issues for you.

abnerlee commented 9 years ago

I'm using gaze@0.5.1 at OS X. It seems 'renamed' will be reported as 'deleted'.