mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(rest) mv copy to fse if empty
This commit is contained in:
parent
8cc1cea7a3
commit
451f3d1e84
1 changed files with 10 additions and 9 deletions
|
|
@ -33,8 +33,15 @@
|
|||
}),
|
||||
|
||||
fse = main.require('fs-extra') || {
|
||||
remove: fs.rmdir.bind(fs),
|
||||
mkdirs: fs.mkdir.bind(fs)
|
||||
remove : fs.rmdir.bind(fs),
|
||||
mkdirs : fs.mkdir.bind(fs),
|
||||
copy : function(from, to, callback) {
|
||||
pipe.create({
|
||||
from : from,
|
||||
to : to,
|
||||
callback : callback
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -387,14 +394,8 @@
|
|||
|
||||
if (!Util.checkObjTrue(lFiles, ['from', 'to']))
|
||||
sendError(pParams, p.data);
|
||||
else if (fse)
|
||||
fse.copy(lFiles.from, lFiles.to, callback);
|
||||
else
|
||||
pipe.create({
|
||||
from : lFiles.from,
|
||||
to : lFiles.to,
|
||||
callback : callback
|
||||
});
|
||||
fse.copy(lFiles.from, lFiles.to, callback);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue