diff --git a/core/src/main/golang/native/delegate/init.go b/core/src/main/golang/native/delegate/init.go index a3eda63c..9b57bc2b 100644 --- a/core/src/main/golang/native/delegate/init.go +++ b/core/src/main/golang/native/delegate/init.go @@ -2,6 +2,8 @@ package delegate import ( "errors" + "fmt" + "strings" "syscall" "github.com/metacubex/mihomo/component/process" @@ -19,7 +21,14 @@ var errBlocked = errors.New("blocked") func Init(home, versionName, gitVersion string, platformVersion int) { log.Infoln("Init core, home: %s, versionName: %s, gitVersion: %s, platformVersion: %d", home, versionName, gitVersion, platformVersion) constant.SetHomeDir(home) - constant.Version = gitVersion + // gitVersion = ${CURRENT_BRANCH}_${COMMIT_HASH}_${COMPILE_TIME} + if versions := strings.Split(gitVersion, "_"); len(versions) == 3 { + constant.Version = fmt.Sprintf("%s-%s-CMFA-%s", strings.ToLower(versions[0]), versions[1], strings.ToLower(versionName)) + constant.BuildTime = versions[2] + } else { + constant.Version = gitVersion + } + constant.Version = strings.ToLower(constant.Version) app.ApplyVersionName(versionName) app.ApplyPlatformVersion(platformVersion)