-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Method _stat calls _emitDir when a directory is found, even when recursion is disabled, and this makes the counter dirs to accumulate the number of analyzed directories.
For instance, let's suppose that we have a directory foo with the subdirectories bar and zoo:
foo/
|_ bar/
|_ file1.jpg
|_ zoo/
|_ file1.txt
|_ file2.txt
A recursive walk in foo makes filewalker.dirs to be 3, correctly.
However, a non-recursive walk in foo also makes filewalker.dirs to be 3, instead of being 1.
Here the method _stat compares whether the entry is a directory and then it calls _emitDir. I think it can be changed to the following comparison:
if ( s.isDirectory() && ( this.recursive || ! this.recursive && this.dirs < 1 ) ) {
// ... (same as currently)
}
Metadata
Metadata
Assignees
Labels
No labels