From 4d48492a0596b3d36613f40e120301fde41e0dee Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 30 Dec 2024 22:15:31 +0800 Subject: [PATCH 1/2] :art: Add Unzip API for HarmonyOS --- kernel/harmony/kernel.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/harmony/kernel.go b/kernel/harmony/kernel.go index fc9828997..f692aa077 100644 --- a/kernel/harmony/kernel.go +++ b/kernel/harmony/kernel.go @@ -24,6 +24,7 @@ import ( "strings" "time" + "github.com/88250/gulu" "github.com/siyuan-note/filelock" "github.com/siyuan-note/logging" "github.com/siyuan-note/siyuan/kernel/cache" @@ -130,4 +131,11 @@ func DisableFeature(feature *C.char) { util.DisableFeature(C.GoString(feature)) } +//export Unzip +func Unzip(zipFilePath, destination string) { + if err := gulu.Zip.Unzip(zipFilePath, destination); nil != err { + logging.LogErrorf("unzip [%s] failed: %s", zipFilePath, err) + } +} + func main() {} From f7a9903715cf6c3234fb97a790863006d9fb19cc Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 30 Dec 2024 22:16:52 +0800 Subject: [PATCH 2/2] :art: Add Unzip API for HarmonyOS --- kernel/harmony/kernel.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/harmony/kernel.go b/kernel/harmony/kernel.go index f692aa077..b9b3f754c 100644 --- a/kernel/harmony/kernel.go +++ b/kernel/harmony/kernel.go @@ -132,8 +132,8 @@ func DisableFeature(feature *C.char) { } //export Unzip -func Unzip(zipFilePath, destination string) { - if err := gulu.Zip.Unzip(zipFilePath, destination); nil != err { +func Unzip(zipFilePath, destination *C.char) { + if err := gulu.Zip.Unzip(C.GoString(zipFilePath), C.GoString(destination)); nil != err { logging.LogErrorf("unzip [%s] failed: %s", zipFilePath, err) } }