Skip to content

Commit

Permalink
set GIT_VERSION to core
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Oct 5, 2024
1 parent aea7edd commit d79fbf2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion core/src/main/cpp/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ Java_com_github_kr328_clash_core_bridge_Bridge_nativeInit(JNIEnv *env, jobject t

scoped_string _home = get_string(home);
scoped_string _version_name = get_string(version_name);
char* _git_version = make_String(GIT_VERSION);

coreInit(_home, _version_name, sdk_version);
coreInit(_home, _version_name, _git_version, sdk_version);
}

JNIEXPORT void JNICALL
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/golang/native/delegate/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import (

var errBlocked = errors.New("blocked")

func Init(home, versionName string, platformVersion int) {
log.Infoln("Init core, home: %s, versionName: %s, platformVersion: %d", home, versionName, platformVersion)
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
app.ApplyVersionName(versionName)
app.ApplyPlatformVersion(platformVersion)

Expand Down
5 changes: 3 additions & 2 deletions core/src/main/golang/native/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ func main() {
}

//export coreInit
func coreInit(home, versionName C.c_string, sdkVersion C.int) {
func coreInit(home, versionName, gitVersion C.c_string, sdkVersion C.int) {
h := C.GoString(home)
v := C.GoString(versionName)
g := C.GoString(gitVersion)
s := int(sdkVersion)

delegate.Init(h, v, s)
delegate.Init(h, v, g, s)

reset()
}
Expand Down

0 comments on commit d79fbf2

Please sign in to comment.