fshost / node-dir

Recursive asynchronous file and directory operations for Node.js
MIT License
221 stars 44 forks source link

dir.files does not traverse symlinked directories #36

Closed miloss closed 8 years ago

miloss commented 8 years ago

If you have symlinks to other directories, they are not being followed but returned as files. For example, assume the following structure added to current test code, where testdir inside testdir4 is symlink:

test 
└─ fixtures
   └─ testdir4
      └─ testdir --> ../testdir

Then the following test case will fail:

it("should iterate files of symlinked directories (recursively)", function(done) {
    dir.files(tdir4, function(err, files) {
        should.not.exist(err);
        var relFiles = files.map(function(curPath) {
            return path.relative(fixturesDir, curPath);
        });
        relFiles.sort().should.eql([
            'testdir4/testdir/file1.txt',
            'testdir4/testdir/file2.text',
            'testdir4/testdir/subdir/file3.txt',
            'testdir4/testdir/subdir/file4.text'
        ]); // Will equal to ['testdir4/testdir']
        done();
    });
});

This was working previously and has degraded from v0.1.14 to v0.1.15.