Browse Source

zip解压目录修改动态获取

master
xyiege 1 month ago
parent
commit
fe85c08e65
  1. 7
      scagent/util/fsutil.go

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

Loading…
Cancel
Save