mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-25 17:04:16 +00:00
chore(main) pSrc -> src
This commit is contained in:
parent
10af73fd49
commit
000665f7a0
1 changed files with 19 additions and 18 deletions
|
|
@ -129,41 +129,42 @@
|
|||
|
||||
/**
|
||||
* function do safe require of needed module
|
||||
* @param {Strin} pSrc
|
||||
* @param {Strin} src
|
||||
*/
|
||||
function mrequire(pSrc) {
|
||||
var lModule, msg,
|
||||
lError = Util.tryCatch(function() {
|
||||
lModule = require(pSrc);
|
||||
function mrequire(src) {
|
||||
var module, msg,
|
||||
error = Util.tryCatch(function() {
|
||||
module = require(src);
|
||||
});
|
||||
|
||||
if (lError && lError.code === 'MODULE_NOT_FOUND')
|
||||
msg = CloudFunc.formatMsg('require', pSrc, 'no');
|
||||
else
|
||||
Util.log(lError);
|
||||
if (error)
|
||||
if (error.code === 'MODULE_NOT_FOUND')
|
||||
msg = CloudFunc.formatMsg('require', src, 'no');
|
||||
else
|
||||
Util.log(error);
|
||||
|
||||
Util.log(msg);
|
||||
|
||||
return lModule;
|
||||
return module;
|
||||
}
|
||||
|
||||
function quietrequire(pSrc) {
|
||||
var lModule;
|
||||
function quietrequire(src) {
|
||||
var module;
|
||||
|
||||
Util.tryCatch(function() {
|
||||
lModule = require(pSrc);
|
||||
module = require(src);
|
||||
});
|
||||
|
||||
return lModule;
|
||||
return module;
|
||||
}
|
||||
|
||||
function rootrequire(pSrc) { return mrequire(DIR + pSrc); }
|
||||
function rootrequire(src) { return mrequire(DIR + src); }
|
||||
|
||||
function librequire(pSrc) { return mrequire(LIBDIR + pSrc); }
|
||||
function librequire(src) { return mrequire(LIBDIR + src); }
|
||||
|
||||
function srvrequire(pSrc) { return mrequire(SRVDIR + pSrc); }
|
||||
function srvrequire(src) { return mrequire(SRVDIR + src); }
|
||||
|
||||
function jsonrequire(pSrc) { return mrequire(JSONDIR + pSrc);}
|
||||
function jsonrequire(src) { return mrequire(JSONDIR + src);}
|
||||
|
||||
/**
|
||||
* function check is current platform is win32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue