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

weird things when manipulating folder #236

Open tracy2zhang opened 7 years ago

tracy2zhang commented 7 years ago

here's my code

const gaze = require('gaze')

gaze('src/**/*', function(err, watcher) {
  // Files have all started watching
  // watcher === this
  if (err) console.error(err)

  console.log('gazing')
  // On changed/added/deleted
  this.on('all', function(event, filepath) {
    console.log(filepath + ' was ' + event)
  })

  this.on('error', err => console.error)
})

when I create a new folder in the images folder, console log 'src/images/untitled/ was added', that's correct, but then I rename it to 'test', console log 'src/images/test/ was added', nothing to do with the untitled folder. When I delete the untitled folder, nothing printed. More precisely, it seems dont react to any deletion of folders. even though I set glob to 'src/*/', sometimes it will print 'node_modules/ was added'

shama commented 7 years ago

Which OS, version and nodejs version?

tracy2zhang commented 7 years ago

@shama macOS v10.12.3 nodejs v7.7.2