This commit is contained in:
Daniel Holmes 2013-08-02 01:39:49 -07:00
commit 848dcfadd6

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.
*/
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.'));