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() {