Skip to content

Commit

Permalink
A: libname.SetTempDllDir
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangli10 committed Jul 19, 2023
1 parent b64658d commit 610326a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkgs/libname/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ import (

var (
LibName = ""
tempDllDir = ""
platformExtNames = map[string]string{
"windows": ".dll",
"linux": ".so",
"darwin": ".dylib",
}
)

func SetTempDllDir(dir string) {
tempDllDir = dir
}

func GetDLLName() string {
libName := "liblcl"
if ext, ok := platformExtNames[runtime.GOOS]; ok {
Expand All @@ -44,6 +49,12 @@ func GetDLLName() string {
// 推荐[当前目录]或指定[ENERGY_HOME]环境变量
func LibPath() string {
var dllName = GetDLLName()

//tempdll内置字节码设置目录
var tempdllPathLibName = path.Join(tempDllDir, dllName)
if tools.IsExist(tempdllPathLibName) {
return tempdllPathLibName
}
//当前目录
var currentPathLibName = path.Join(consts.ExePath, dllName)
if tools.IsExist(currentPathLibName) {
Expand Down

0 comments on commit 610326a

Please sign in to comment.