Commit 0c99a4da authored by Medicean's avatar Medicean

(Enhance: Other) 优化插件加载, 加载异常的插件不会再影响到其它插件加载了

parent 76976672
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
> 有空会补补BUG、添添新功能。 > 有空会补补BUG、添添新功能。
> 同时也欢迎大家的参与!感谢各位朋友的支持! .TAT. > 同时也欢迎大家的参与!感谢各位朋友的支持! .TAT.
## `v(2.1.10)`
### 其它
* 优化插件加载, 加载异常的插件不会再影响到其它插件加载了
## 2020/09/10 `v(2.1.9)` ## 2020/09/10 `v(2.1.9)`
### 核心 ### 核心
......
...@@ -125,11 +125,15 @@ const antSword = window.antSword = { ...@@ -125,11 +125,15 @@ const antSword = window.antSword = {
return return
} }
// 存储路径&&package信息到全局变量antSword['plugins'] // 存储路径&&package信息到全局变量antSword['plugins']
try {
antSword['plugins'][_] = { antSword['plugins'][_] = {
_id: _, _id: _,
path: pluginPath, path: pluginPath,
info: JSON.parse(fs.readFileSync(path.join(pluginPath, 'package.json'))) info: JSON.parse(fs.readFileSync(path.join(pluginPath, 'package.json')))
} }
} catch (error) {
return
}
}); });
// 加载插件::开发 // 加载插件::开发
let devPlugPath = antSword.storage('dev-plugPath'); let devPlugPath = antSword.storage('dev-plugPath');
...@@ -142,11 +146,15 @@ const antSword = window.antSword = { ...@@ -142,11 +146,15 @@ const antSword = window.antSword = {
if (!fs.lstatSync(_path).isDirectory()) { if (!fs.lstatSync(_path).isDirectory()) {
return return
} }
try {
antSword['plugins'][_] = { antSword['plugins'][_] = {
_id: _, _id: _,
path: _path, path: _path,
info: JSON.parse(fs.readFileSync(path.join(_path, 'package.json'))) info: JSON.parse(fs.readFileSync(path.join(_path, 'package.json')))
} }
} catch (error) {
return
}
}); });
} }
// 加载工具栏 // 加载工具栏
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment