mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
fix(flop) copy: add directory check
This commit is contained in:
parent
a267eac253
commit
19c8fd600d
1 changed files with 10 additions and 7 deletions
|
|
@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue