Merge pull request #59 from aogriffiths/patch-1

Update wrench.js
This commit is contained in:
Ryan McGrath 2013-10-15 14:51:41 -07:00
commit f6074405ba

View file

@ -323,11 +323,12 @@ exports.rmdirRecursive = function rmdirRecursive(dir, failSilent, clbk){
* Note: Directories should be passed to this function without a trailing slash. * Note: Directories should be passed to this function without a trailing slash.
*/ */
exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, opts, clbk) { exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, opts, clbk) {
var originalArguments = Array.prototype.slice.apply(arguments);
fs.stat(newDir, function(err, newDirStat){ fs.stat(newDir, function(err, newDirStat){
if(!err) { if(!err) {
if(typeof opts !== 'undefined' && typeof opts !== 'function' && opts.forceDelete) if(typeof opts !== 'undefined' && typeof opts !== 'function' && opts.forceDelete)
return exports.rmdirRecursive(newDir, function(err){ return exports.rmdirRecursive(newDir, function(err){
copyDirRecursive.apply(this, arguments); copyDirRecursive.apply(this, originalArguments);
}); });
else else
return clbk(new Error('You are trying to delete a directory that already exists. Specify forceDelete in an options object to override this.')); return clbk(new Error('You are trying to delete a directory that already exists. Specify forceDelete in an options object to override this.'));