fix(flop) copy: add directory check

This commit is contained in:
coderaiser 2014-06-23 04:57:42 -04:00
parent a267eac253
commit 19c8fd600d

View file

@ -90,15 +90,18 @@
exports.copy = function(from, to, callback) {
Util.checkArgs(arguments, ['from', 'to', 'callback']);
pipe.create(from, to, function(error) {
var isDir = error && error.code === 'EISDIR';
fs.lstat(from, function(error, stat) {
var isDir = stat && stat.isDirectory();
if (isDir && ncp)
ncp(from, to, {
stopOnError: true
}, callback);
else
if (error)
callback(error);
else if (isDir)
if (ncp)
ncp(from, to, {
stopOnError: true
}, callback);
else
pipe.create(from, to, callback);
});
};