添加错误码自动提取

This commit is contained in:
2025-09-27 23:58:21 +08:00
parent 49c2d264b5
commit cee7898fff
2 changed files with 46 additions and 13 deletions
+24
View File
@@ -0,0 +1,24 @@
package zm_lib
import (
"errors"
"os"
"path/filepath"
"strings"
)
// GetPluginPathByWd 获取项目根目录 通过当前cmd 地址
func GetPluginPathByWd(pluginName string) (string, error) {
currentDir, err := os.Getwd()
if err != nil {
return "", err
}
// 写入默认数据
pluginSpilt := strings.Split(currentDir, pluginName)
if len(pluginSpilt) > 1 {
pluginSpilt = pluginSpilt[:len(pluginSpilt)-1]
return filepath.Join(strings.Join(pluginSpilt, pluginName), pluginName), nil
}
return "", errors.New("no find plugin")
}