Resolve this merge conflict that I somehow 100% totally missed (fixes #63)

This commit is contained in:
Ryan McGrath 2013-10-16 07:46:46 +09:00
parent 99686fbdc2
commit 5c716f9c0d
2 changed files with 24 additions and 42 deletions

View file

@ -355,30 +355,25 @@ exports.rmdirRecursive = function rmdirRecursive(dir, failSilent, clbk){
if(err && typeof failSilent === 'boolean' && !failSilent) if(err && typeof failSilent === 'boolean' && !failSilent)
return clbk(err); return clbk(err);
<<<<<<< HEAD
if(typeof failSilent === 'function') if(typeof failSilent === 'function')
clbk = failSilent; clbk = failSilent;
=======
if(typeof failSilent === 'function') (function rmFile(err){
clbk = failSilent; if (err) return clbk(err);
>>>>>>> 7827a700ff8cb8b742e401e9876e86a63ae0c68a
(function rmFile(err){ var filename = files.shift();
if (filename === null || typeof filename == 'undefined')
return fs.rmdir(dir, clbk);
var file = dir+'/'+filename;
fs.lstat(file, function(err, stat){
if (err) return clbk(err); if (err) return clbk(err);
if (stat.isDirectory())
var filename = files.shift(); rmdirRecursive(file, rmFile);
if (filename === null || typeof filename == 'undefined') else
return fs.rmdir(dir, clbk); fs.unlink(file, rmFile);
});
var file = dir+'/'+filename; })();
fs.lstat(file, function(err, stat){
if (err) return clbk(err);
if (stat.isDirectory())
rmdirRecursive(file, rmFile);
else
fs.unlink(file, rmFile);
});
})();
}); });
}; };
@ -394,31 +389,18 @@ exports.copyDirRecursive = function copyDirRecursive(srcDir, newDir, opts, clbk)
srcDir = _path.normalize(srcDir); srcDir = _path.normalize(srcDir);
newDir = _path.normalize(newDir); newDir = _path.normalize(newDir);
fs.stat(newDir, function(err, newDirStat){ fs.stat(newDir, function(err, newDirStat) {
if(!err) { if(!err) {
<<<<<<< HEAD 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, originalArguments);
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.')); }
}
if(typeof opts === 'function') if(typeof opts === 'function')
clbk = opts; clbk = opts;
=======
if(typeof opts !== 'undefined' && typeof opts !== 'function' && opts.forceDelete)
return exports.rmdirRecursive(newDir, function(err){
copyDirRecursive.apply(this, arguments);
});
else
return clbk(new Error('You are trying to delete a directory that already exists. Specify forceDelete in an options object to override this.'));
}
if(typeof opts === 'function')
clbk = opts;
>>>>>>> 7827a700ff8cb8b742e401e9876e86a63ae0c68a
fs.stat(srcDir, function(err, srcDirStat){ fs.stat(srcDir, function(err, srcDirStat){
if (err) return clbk(err); if (err) return clbk(err);

View file

@ -1,7 +1,7 @@
{ {
"name": "wrench", "name": "wrench",
"description": "Recursive filesystem (and other) operations that Node *should* have.", "description": "Recursive filesystem (and other) operations that Node *should* have.",
"version": "1.5.3", "version": "1.5.4",
"author": "Ryan McGrath <ryan@venodesigns.net>", "author": "Ryan McGrath <ryan@venodesigns.net>",
"repository": { "repository": {