From 37c9cf365326e1c5e7d6ae86a2b22e030175cac8 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 8 Jun 2013 15:57:42 +1000 Subject: [PATCH] Fixed copyDirRecursive for overwrites --- lib/wrench.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/wrench.js b/lib/wrench.js index 6cfa8c6..adaf588 100644 --- a/lib/wrench.js +++ b/lib/wrench.js @@ -323,11 +323,12 @@ exports.rmdirRecursive = function rmdirRecursive(dir, failSilent, clbk){ * Note: Directories should be passed to this function without a trailing slash. */ exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, opts, clbk) { + var copyDirArguments = arguments; fs.stat(newDir, function(err, newDirStat){ if(!err) { if(typeof opts !== 'undefined' && typeof opts !== 'function' && opts.forceDelete) return exports.rmdirRecursive(newDir, function(err){ - copyDirRecursive.apply(this, arguments); + copyDirRecursive.apply(this, copyDirArguments); }); else return clbk(new Error('You are trying to delete a directory that already exists. Specify forceDelete in an options object to override this.'));