gaze icon indicating copy to clipboard operation
gaze copied to clipboard

Adding file to a folder being watched doesn't catch and changing file --> show as deleted

Open cooolbasha opened this issue 11 years ago • 8 comments

I am windows 7/ node v0.10.24 / gaze latest (0.6.4)

Adding file to a folder being watched doesn't catch and changing a watched file --> show as deleted events thrown only once for each file...

cooolbasha avatar Jun 08 '14 20:06 cooolbasha

Could you provide an example of what you have tried? Thanks!

shama avatar Jun 08 '14 20:06 shama

let me take back the 2nd and 3rd issue --. When I do the change from sublime text 3...it says I deleted...kind of wierd. and from there on when I make any more change..no events..because for gaze it is already deleted.when I changed the file from notepad++ after restarting the program...it is saying changed.

Adding file to a folder being watched doesn't catch

var gaze = require('gaze');

// Watch all .js files/dirs in process.cwd()
gaze('c:/w-jobs/**/*.coffee', function(err, watcher) {
    // Files have all started watching
    // watcher === this

    // Get all watched files
    this.watched(function(err, watched) {
        console.log(watched);
    });

    // On file changed
    this.on('changed', function(filepath) {
        console.log(filepath + ' was changed');
    });

    // On file added
    this.on('added', function(filepath) {
        console.log(filepath + ' was added');
    });

    // On file deleted
    this.on('deleted', function(filepath) {
        console.log(filepath + ' was deleted');
    });

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

    // Get watched files with relative paths
    this.relative(function(err, files) {
        console.log(files);
    });
});

cooolbasha avatar Jun 08 '14 20:06 cooolbasha

Try this instead and let me know if that fixes it.

gaze('**/*.coffee', { cwd: 'c:/w-jobs/' }, function(err, watcher) {

shama avatar Jun 08 '14 20:06 shama

It seems to help with the deleted event getting triggered for changed files (in sublime) but it first added..and from then on it is just showing changed...but at first it said added followed by changed.

but it didn't help with the addition of file to the folder

cooolbasha avatar Jun 08 '14 21:06 cooolbasha

if i run this program under the same directory under which all the things are done...it is working say for eg I am c:\w and I am watching */.coffee it works fine if I add a file.coffee to the c:\w\coff\1.coffee .. But If I try to watch a different directory c:\w-jobs ..it doesn't work even though I tried cwd...ANY CLUES please

cooolbasha avatar Jun 08 '14 21:06 cooolbasha

Same issue here - on first change any file is emitted as added before changed.

RReverser avatar Jun 11 '14 12:06 RReverser

This is sort of a Sublime issue, with the way SublimeText 3 handles Atomic Saves - http://stackoverflow.com/questions/20634684/what-is-sublime-text-doing-when-i-save-a-file

DavidSouther avatar Jun 26 '14 22:06 DavidSouther

Yep. Seeing the same issue here with ST3....

schmod avatar Jul 01 '14 20:07 schmod