fix: 文件复制到本地时创建文件目录避免路径错误
This commit is contained in:
@@ -59,6 +59,11 @@ func CompressZipByFile(zipFilePath, filePath string) error {
|
||||
|
||||
// CompressZipByDir 将目录下文件添加到 ZIP 压缩文件
|
||||
func CompressZipByDir(zipFilePath, dirPath string) error {
|
||||
// 创建本地输出目录
|
||||
if err := os.MkdirAll(filepath.Dir(zipFilePath), 0775); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 创建输出文件
|
||||
zipWriter, err := os.Create(zipFilePath)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user