From 174a7befbeeacac0d40459123c80874bf2b06b34 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 27 Aug 2025 11:25:20 +0800 Subject: [PATCH] :art: Support opening assets through other apps on HarmonyOS NEXT https://github.com/siyuan-note/siyuan/issues/15691 --- kernel/harmony/kernel.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kernel/harmony/kernel.go b/kernel/harmony/kernel.go index b9b3f754c..40bf54a27 100644 --- a/kernel/harmony/kernel.go +++ b/kernel/harmony/kernel.go @@ -93,18 +93,18 @@ func SetHttpServerPort(port int) { } //export GetCurrentWorkspacePath -func GetCurrentWorkspacePath() string { - return util.WorkspaceDir +func GetCurrentWorkspacePath() *C.char { + return C.CString(util.WorkspaceDir) } //export GetAssetAbsPath -func GetAssetAbsPath(asset string) (ret string) { - ret, err := model.GetAssetAbsPath(asset) - if err != nil { - logging.LogErrorf("get asset [%s] abs path failed: %s", asset, err) - ret = asset +func GetAssetAbsPath(relativePath *C.char) *C.char { + absPath, err := model.GetAssetAbsPath(C.GoString(relativePath)) + if nil != err { + logging.LogErrorf("get asset abs path failed: %s", err) + return relativePath } - return + return C.CString(absPath) } //export GetMimeTypeByExt