2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 07:57:21 +08:00

fix: 压缩时自动创建目标目录

This commit is contained in:
2026-01-24 01:31:25 +08:00
parent c3d5cdee5c
commit 13f06322dd

View File

@@ -29,6 +29,10 @@ func Compress(dir string, src []string, dst string) error {
src = append(src, ".")
}
if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
return err
}
format, err := formatArchiveByPath(dst)
if err != nil {
return err
@@ -59,10 +63,8 @@ func UnCompress(src string, dst string) error {
if !filepath.IsAbs(src) || !filepath.IsAbs(dst) {
return errors.New("src and dst must be absolute path")
}
if !Exists(dst) {
if err := os.MkdirAll(dst, 0755); err != nil {
return err
}
if err := os.MkdirAll(dst, 0755); err != nil {
return err
}
format, err := formatArchiveByPath(src)