fix: 文件复制到本地时创建文件目录避免路径错误

This commit is contained in:
TsMask committed 2024-07-12 19:16:18 +08:00
1 parent 63ddc3bfd7
commit a62bfc4e28
3 files changed
+15 -40

No files matched your search

+5
View File
@@ -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 {