Add getModulePaths to module_util, call it from events.registerModules
This commit is contained in:
parent
06e84eee94
commit
b383950314
|
@ -23,10 +23,12 @@ var self = module.exports = {
|
|||
eventEmitter.removeListener(eventName, listener);
|
||||
},
|
||||
registerModules: function() {
|
||||
var mods = fs.readdirSync(Config.config.paths.mods);
|
||||
const moduleUtil = require('./module_util.js');
|
||||
|
||||
moduleUtil.getModulePaths().forEach(function(modulePath) {
|
||||
var mods = fs.readdirSync(modulePath);
|
||||
mods.forEach(function(item) {
|
||||
var modPath = Config.config.paths.mods+item;
|
||||
var modPath = modulePath+item;
|
||||
if (item.substr(item.length-3) != '.js') {
|
||||
modPath += path.sep+item+'.js';
|
||||
}
|
||||
|
@ -43,5 +45,6 @@ var self = module.exports = {
|
|||
logger.log.debug(modPath+" - file not found");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ const async = require('async');
|
|||
exports.loadModuleEx = loadModuleEx;
|
||||
exports.loadModule = loadModule;
|
||||
exports.loadModulesForCategory = loadModulesForCategory;
|
||||
exports.getModulePaths = getModulePaths;
|
||||
|
||||
function loadModuleEx(options, cb) {
|
||||
assert(_.isObject(options));
|
||||
|
@ -97,3 +98,9 @@ function loadModulesForCategory(category, iterator, complete) {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getModulePaths() {
|
||||
return [
|
||||
Config.paths.mods
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue