mirror of
https://github.com/MetaCubeX/ClashMetaForAndroid.git
synced 2024-11-16 13:22:18 +08:00
better Version and BuildTime handle
This commit is contained in:
parent
f0f82fb9f9
commit
266c9da66d
|
@ -2,6 +2,8 @@ package delegate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/metacubex/mihomo/component/process"
|
"github.com/metacubex/mihomo/component/process"
|
||||||
|
@ -19,7 +21,14 @@ var errBlocked = errors.New("blocked")
|
||||||
func Init(home, versionName, gitVersion string, platformVersion int) {
|
func Init(home, versionName, gitVersion string, platformVersion int) {
|
||||||
log.Infoln("Init core, home: %s, versionName: %s, gitVersion: %s, platformVersion: %d", home, versionName, gitVersion, platformVersion)
|
log.Infoln("Init core, home: %s, versionName: %s, gitVersion: %s, platformVersion: %d", home, versionName, gitVersion, platformVersion)
|
||||||
constant.SetHomeDir(home)
|
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.ApplyVersionName(versionName)
|
||||||
app.ApplyPlatformVersion(platformVersion)
|
app.ApplyPlatformVersion(platformVersion)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user