From 7fa875f9666e53c18a3a2afe0449376e59ee2faf Mon Sep 17 00:00:00 2001 From: Vadim Date: Sat, 18 Jun 2022 10:38:08 +0300 Subject: [PATCH] fix: cbz packer --- packer.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packer.go b/packer.go index 41496f51..6fa0f51c 100644 --- a/packer.go +++ b/packer.go @@ -46,6 +46,15 @@ func PackToZip(images []string, destination string, withExtension bool) (string, if withExtension { destination += ".zip" } + + if exists, err := Afero.Exists(filepath.Dir(destination)); err != nil { + return "", err + } else if !exists { + if err := Afero.MkdirAll(filepath.Dir(destination), 0777); err != nil { + return "", err + } + } + zipFile, err := Afero.Create(destination) if err != nil { return "", err