diff --git a/core/src/main/cpp/main.c b/core/src/main/cpp/main.c index 2ad3f717..914bf7d9 100644 --- a/core/src/main/cpp/main.c +++ b/core/src/main/cpp/main.c @@ -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 diff --git a/core/src/main/golang/native/delegate/init.go b/core/src/main/golang/native/delegate/init.go index 21f5aa37..a3eda63c 100644 --- a/core/src/main/golang/native/delegate/init.go +++ b/core/src/main/golang/native/delegate/init.go @@ -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) diff --git a/core/src/main/golang/native/main.go b/core/src/main/golang/native/main.go index c2c37547..077587d1 100644 --- a/core/src/main/golang/native/main.go +++ b/core/src/main/golang/native/main.go @@ -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() }