mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-24 05:03:06 +00:00
feat: commit code
This commit is contained in:
parent
f238e43bff
commit
cf9a9513df
2 changed files with 13 additions and 12 deletions
|
@ -33,11 +33,6 @@ impl PluginManager {
|
|||
pub fn init(config: toml::Value) -> anyhow::Result<()> {
|
||||
let lua = LUA.lock().unwrap();
|
||||
|
||||
if !config.is_table() {
|
||||
// if plugins config is not a table, then termination init
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let manager = lua.create_table().unwrap();
|
||||
let plugin_dir = Self::init_plugin_dir();
|
||||
|
||||
|
@ -55,6 +50,8 @@ impl PluginManager {
|
|||
lua.globals()
|
||||
.set("library_dir", plugin_dir.to_str().unwrap())
|
||||
.unwrap();
|
||||
// lua.globals()
|
||||
// .set("config_info", );
|
||||
|
||||
let mut index: u32 = 1;
|
||||
let mut init_list: Vec<(u32, PathBuf, PluginInfo)> = Vec::new();
|
||||
|
@ -122,16 +119,20 @@ impl PluginManager {
|
|||
}
|
||||
Ok(false) => {
|
||||
log::warn!("Plugin init function result is `false`, init failed.");
|
||||
let _ = lua.load(mlua::chunk! {
|
||||
let _ = lua
|
||||
.load(mlua::chunk! {
|
||||
table.remove(manager, $idx)
|
||||
}).exec();
|
||||
})
|
||||
.exec();
|
||||
}
|
||||
Err(e) => {
|
||||
// plugin init failed
|
||||
log::warn!("Plugin init failed: {e}");
|
||||
let _ = lua.load(mlua::chunk! {
|
||||
let _ = lua
|
||||
.load(mlua::chunk! {
|
||||
table.remove(manager, $idx)
|
||||
}).exec();
|
||||
})
|
||||
.exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue