refactor(rest) mv copy to fse if empty

This commit is contained in:
coderaiser 2014-02-13 02:36:12 -05:00
parent 8cc1cea7a3
commit 451f3d1e84

View file

@ -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;