fix(ncp) call cb only if no case is suitable

This commit is contained in:
coderaiser 2014-11-10 08:56:37 -05:00
parent 80e08707e2
commit e04500a9a5

View file

@ -95,13 +95,11 @@ function ncp (source, dest, options, callback) {
isWritable(target, function (writable) {
if (writable) {
return copyFile(file, target);
}
if(clobber) {
} else if (clobber) {
rmFile(target, function () {
copyFile(file, target);
});
}
if (modified) {
} else if (modified) {
var stat = dereference ? fs.stat : fs.lstat;
stat(target, function(err, stats) {
//if souce modified time greater to target modified time copy file
@ -109,6 +107,8 @@ function ncp (source, dest, options, callback) {
copyFile(file, target);
else return cb();
});
} else {
cb();
}
});
}