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

Commit

Permalink
Merge pull request #77 from SamyPesse/patch-1
Browse files Browse the repository at this point in the history
Fix copyDirRecursive error callback
  • Loading branch information
Ryan McGrath committed Feb 10, 2014
2 parents 666e0c7 + b655e26 commit e5f08b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/wrench.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,17 @@ exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, opts, clbk)
newFile = newDir+'/'+filename;

fs.stat(file, function(err, fileStat){
if (err) return clbk(err);
if (fileStat.isDirectory())
copyDirRecursive(file, newFile, copyFiles);
copyDirRecursive(file, newFile, copyFiles, clbk);
else if (fileStat.isSymbolicLink())
fs.readlink(file, function(err, link){
if (err) return clbk(err);
fs.symlink(link, newFile, copyFiles);
});
else
fs.readFile(file, function(err, data){
if (err) return clbk(err);
fs.writeFile(newFile, data, copyFiles);
});
});
Expand Down

0 comments on commit e5f08b8

Please sign in to comment.