minor changes

This commit is contained in:
coderaiser 2013-02-22 11:18:19 -05:00
parent 0dd4bdae35
commit ac18f7143b
5 changed files with 63 additions and 21 deletions

View file

@ -50,7 +50,7 @@
FallBack_s += lName + ' ' + lCurrentName[lName] + '\n';
exports.watch(lCurrentName[lName]);
}
else exports.watch(pFileNames[i]);
}
else exports.watch(pFileNames);
@ -90,7 +90,7 @@
if(fs.exists)
fs.exists(pFileName, lWatch_f);
else lWatch_f();
NamesList_s += pFileName + '\n';
FileNames[pFileName] = true;
}

View file

@ -53,6 +53,8 @@
/* compitability with old versions of node */
exports.fs.exists = exports.fs.exists || exports.path.exists;
//exports.fs.watch = isWin32 ? fs.watch : linuxWatch;
/* Needed Modules */
exports.util = Util = require(LIBDIR + 'util'),
@ -60,7 +62,6 @@
exports.zlib = zlib = mrequire('zlib'),
/* Main Information */
exports.config = jsonrequire('config');
exports.modules = jsonrequire('modules');
exports.ext = ext = jsonrequire('ext');
exports.mainpackage = rootrequire('package');
@ -240,4 +241,12 @@
return lQuery;
}
function linuxWatch(pFile, pCallBack){
fs.watchFile(pFile, function(pCurr, pPrev){
if(pCurr.mtime !== pPrev.mtime)
Util.exec(pCallBack);
});
}
})();

View file

@ -1,7 +1,7 @@
/* RESTfull module */
(function(){
"use strict";
'use strict';
if(!global.cloudcmd)
return console.log(
@ -15,8 +15,7 @@
var main = global.cloudcmd.main,
Util = main.util,
Config = main.config,
APIURL = Config.api_url,
OK = 200,
Header = main.generateHeaders('api.json', false);
@ -29,13 +28,15 @@
lReq = pParams.request,
lRes = pParams.response,
lUrl = lReq.url,
lMethod = lReq.method;
lMethod = lReq.method,
lConfig = main.config,
lAPIURL = lConfig.api_url;
if( Util.isContainStr(lUrl, APIURL) ){
if( Util.isContainStr(lUrl, lAPIURL) ){
lRet = true;
getBody(lReq, function(pBody){
var lCommand = Util.removeStr(lUrl, APIURL),
var lCommand = Util.removeStr(lUrl, lAPIURL),
lData = getData({
command : lCommand,
method : lMethod,