From fe85c08e65e6ec48769ec960e9be2d8ea45462a3 Mon Sep 17 00:00:00 2001 From: xc Date: Thu, 23 Oct 2025 12:30:06 +0800 Subject: [PATCH] =?UTF-8?q?zip=E8=A7=A3=E5=8E=8B=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A8=E6=80=81=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scagent/util/fsutil.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scagent/util/fsutil.go b/scagent/util/fsutil.go index c06591a..e088974 100644 --- a/scagent/util/fsutil.go +++ b/scagent/util/fsutil.go @@ -266,8 +266,9 @@ func ZipFiles(zipname string, files []string, zippath string) error { // 解压缩zip文件 // 这个方法必须是首字母大写的,才能被注册 -// src: 需要解压的zip文件 -func DecompressZip(zpFname string) error { +// zpFname: 需要解压的zip文件 +// dirpath: 解压到的目录 +func DecompressZip(zpFname string, dirpath string) error { // 下载文件 archive, err := zip.OpenReader(zpFname) if err != nil { @@ -279,7 +280,7 @@ func DecompressZip(zpFname string) error { // 遍历目录 for _, f := range archive.File { // zip 解压的时候,路径为监听的路径 - filePath := filepath.Join(config.G.FilePath, f.Name) + filePath := filepath.Join(dirpath, f.Name) // 暂停原因 屏蔽解压到files 目录下 //filePath := filepath.Join(dir, f.Name) if f.FileInfo().IsDir() {