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

Commit

Permalink
Fix copyDirRecursive error callback
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse committed Feb 9, 2014
1 parent 65e80e5 commit b655e26
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 @@ -432,14 +432,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 b655e26

Please sign in to comment.