Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Adding" files/folders emitter NOT fired. (Mac OS X 10.11) #205

Open
mralexgray opened this issue Nov 8, 2015 · 7 comments
Open

"Adding" files/folders emitter NOT fired. (Mac OS X 10.11) #205

mralexgray opened this issue Nov 8, 2015 · 7 comments

Comments

@mralexgray
Copy link

Proof is in pudding..

var gaze = require('gaze'),
       t = require('touch'),
    base = '/private/var/tmp/',
existing = base + 'existingfile' + Math.random(), 
 newfile = base + 'newfile' + Math.random()

touch.sync(existing)

gaze (base + '*', function(err, watcher){
    this.on('all', function(event, filepath) {
        console.log (filepath + ' was ' + event)
    })
    setTimeout(function () {
        touch(newfile) // This will never be noticed.
        touch(existing) // Touching existing files works ok.
    }, 3000);
})

/private/var/tmp/existingfile0.5537692755460739 was changed

The new file that also got touched /private/var/tmp/newfileXYZ.... _never gets a notification_ 👎

@shama
Copy link
Owner

shama commented Nov 9, 2015

Gaze uses file patterns instead of file paths to watch files. Try this instead:

gaze('*', { cwd: base }, function () {
  this.on('all', function (event, filepath) {
    console.log(filepath + ' was ' + event)
  })
})

@mikeyhew
Copy link

So you just need to add the "cwd" option, right? Would be good to add to the readme.

@mikeyhew
Copy link

Wait no, that's not it. Somehow as soon as I change '*' to '*.js' it stops detecting new files. Why is that?

@mikeyhew
Copy link

OK never mind, now it's working...

@mikeyhew
Copy link

Sorry for all the comments, but I did some more testing and figured some things out: it seems to detect new files if and only if there is no / in the glob pattern. Which I guess is what @shama meant with "file patterns instead of file paths"

@thehappycoder
Copy link

With gaze(${watchedDirName}/**/*, ...) no events when adding a new folder

@TehShrike
Copy link

I suspect this is a duplicate of #167.

blueneogeo added a commit to flutter-view/flutter-view that referenced this issue Aug 2, 2018
…hama/gaze#205

workaround by allowing a single dir as cwd property, avoiding a full dir path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants