pvorb/node-dive

Cannot walk file and directory at the same time

Closed this issue · 1 comments

Hi Paul,
Thanks for your excellent work and contribution.
I find that when walk file and directory together, the walking file function will not work.
Following is the detail:

when I walk file only by calling

dive(process.cwd() + '/modules/', { all: true }, function(err, file) {
    if (err) throw err;
    debug("file:"+file);
}, function() {
    debug('complete');
});

the result is:

  lib>util:dev-debug file:/Users/tony/Development/wcms/modules/authorization/models/RoleModel.js +28ms
  lib>util:dev-debug file:/Users/tony/Development/wcms/modules/authorization/routes/Role.js +1ms
  lib>util:dev-debug file:/Users/tony/Development/wcms/modules/authorization/views/index.html +0ms 
  lib>util:dev-debug complete +0ms

but when I walk file and directory together by calling

dive(process.cwd() + '/modules/', { all: true }, function(err, file) {
    if (err) throw err;
    debug("file:"+file);
}, function() {
    debug('complete');
});

dive(process.cwd() + '/modules/', { directories: true, files: false }, function(err, dir) {
    if (err) throw err;
    debug("dir:"+dir);
},function() {
    debug('complete');
});

the result is:

  lib>util:dev-debug file:/Users/tony/Development/wcms/modules/authorization +107ms
  lib>util:dev-debug dir:/Users/tony/Development/wcms/modules/authorization +0ms
lib>util:dev-debug file:/Users/tony/Development/wcms/modules/authorization/config +2ms
  lib>util:dev-debug file:/Users/tony/Development/wcms/modules/authorization/controllers +0ms
  lib>util:dev-debug file:/Users/tony/Development/wcms/modules/authorization/models +1ms
  lib>util:dev-debug file:/Users/tony/Development/wcms/modules/authorization/routes +0ms
  lib>util:dev-debug file:/Users/tony/Development/wcms/modules/authorization/views +0ms
  lib>util:dev-debug dir:/Users/tony/Development/wcms/modules/authorization/config +0ms
  lib>util:dev-debug dir:/Users/tony/Development/wcms/modules/authorization/controllers +0ms
  lib>util:dev-debug dir:/Users/tony/Development/wcms/modules/authorization/models +0ms
  lib>util:dev-debug dir:/Users/tony/Development/wcms/modules/authorization/routes +0ms
  lib>util:dev-debug dir:/Users/tony/Development/wcms/modules/authorization/views +0ms
  lib>util:dev-debug complete +28ms
  lib>util:dev-debug complete +0ms

The files are gone when call walk file and directory together.

@TonyLuo Please verify that the update solves your problem.