Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Commit

Permalink
Set isDir to false for non-existant directory
Browse files Browse the repository at this point in the history
The PR for issue #45 resolves problems for `readdirRecursive`, but not for `readdirRecursiveSync`. This patch sets `isDir = false` when a directory cannot be found, effectively ceasing further processing.
  • Loading branch information
coreybutler committed Mar 1, 2014
1 parent c2dce2f commit de1d50d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/wrench.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports.readdirSyncRecursive = function(baseDir) {
curFiles,
nextDirs,
isDir = function(fname){
return fs.statSync( _path.join(baseDir, fname) ).isDirectory();
return fs.existsSync(_path.join(baseDir, fname)) ? fs.statSync( _path.join(baseDir, fname) ).isDirectory() : false;
},
prependBaseDir = function(fname){
return _path.join(baseDir, fname);
Expand Down

0 comments on commit de1d50d

Please sign in to comment.