feature(main) readFiles: add formatMsg

This commit is contained in:
coderaiser 2013-10-18 08:08:56 +00:00
parent 2c8edb698c
commit a57058dbda

View file

@ -11,7 +11,7 @@
SLASH,
ISWIN32,
ext,
path, fs, zlib, url, pipe,
path, fs, zlib, url, pipe, CloudFunc,
OK, FILE_NOT_FOUND, MOVED_PERMANENTLY,
REQUEST, RESPONSE,
@ -105,7 +105,7 @@
exports.socket = srvrequire('socket'),
exports.auth = srvrequire('auth').auth,
exports.appcache = srvrequire('appcache'),
exports.cloudfunc = librequire('cloudfunc'),
exports.cloudfunc = CloudFunc = librequire('cloudfunc'),
exports.dir = srvrequire('dir'),
exports.rest = srvrequire('rest').api,
exports.update = srvrequire('update'),
@ -370,7 +370,8 @@
lErrors,
lReadedFiles = {},
lDoneFunc = function (pParams){
var lRet = Util.checkObj(pParams, ['error', 'data', 'params']);
var msg, status,
lRet = Util.checkObj(pParams, ['error', 'data', 'params']);
if(lRet){
lDone.pop();
@ -378,15 +379,21 @@
lName = p.params;
if(p.error){
status = 'error';
if(!lErrors) lErrors = {};
lErrors[lName] = p.error;
}
else{
Util.log(lName + ' readed');
status = 'ok';
lReadedFiles[lName] = p.data;
}
lName = path.basename(lName);
msg = CloudFunc.formatMsg('read', lName, status);
Util.log(msg);
if( !lDone.length )
Util.exec(pCallBack, lErrors, lReadedFiles);
}