feat: 调整类库加载逻辑 添加papi兼容

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
2017-09-27 20:40:57 +08:00
parent 9556008bee
commit 2228863d56
11 changed files with 133 additions and 47 deletions

View File

@ -1,5 +1,7 @@
'use strict';
/**
* MiaoScript脚本插件加载类
*/
/*global Java, base, module, exports, require, __FILE__*/
var zip = require("core/zip");
var fs = require('core/fs');
@ -25,9 +27,9 @@ function loadPlugins(path) {
* @param path
*/
function updatePlugins(path) {
var dir = fs.file(path, "update");
fs.list(dir).forEach(function (file) {
var update = fs.file(path, "update");
fs.list(update).forEach(function (file) {
fs.move(fs.file(update, file.name), fs.file(path, file.name), true);
})
}
@ -66,6 +68,7 @@ exports.$ = undefined;
exports.plugins = [];
exports.init = function (plugin, path) {
if (plugin !== null) {
// 如果过plugin不等于null 则代表是正式环境
exports.$ = plugin;
log.i("Init MiaoScript Engine Version: %s", plugin.description.version);
require('./event');