mirror of
https://github.com/Monibuca/engine.git
synced 2025-10-06 00:56:58 +08:00
修复插件版本显示不正确的问题
This commit is contained in:
8
main.go
8
main.go
@@ -52,19 +52,15 @@ type PluginConfig struct {
|
||||
HotConfig map[string]func(interface{}) //热修改配置
|
||||
}
|
||||
|
||||
// InstallPlugin 安装插件
|
||||
func (opt *PluginConfig) Install(run func()) {
|
||||
opt.Run = run
|
||||
InstallPlugin(opt)
|
||||
}
|
||||
|
||||
// InstallPlugin 安装插件
|
||||
func InstallPlugin(opt *PluginConfig) {
|
||||
Plugins[opt.Name] = opt
|
||||
_, pluginFilePath, _, _ := runtime.Caller(1)
|
||||
opt.Dir = filepath.Dir(pluginFilePath)
|
||||
if parts := strings.Split(opt.Dir, "@"); len(parts) > 1 {
|
||||
opt.Version = parts[len(parts)-1]
|
||||
}
|
||||
Plugins[opt.Name] = opt
|
||||
utils.Print(Green("install plugin"), BrightCyan(opt.Name), BrightBlue(opt.Version))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user