From 855ce864db6e29103967d124a3196cf5901ab2a6 Mon Sep 17 00:00:00 2001 From: Gareth Williams Date: Fri, 28 Jul 2023 18:40:10 +0100 Subject: [PATCH] Actually fix issue --- util.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/util.go b/util.go index e8c3f2b..46af647 100644 --- a/util.go +++ b/util.go @@ -50,6 +50,13 @@ func CopyFile(src, dst string) error { var dstfd *os.File var srcinfo os.FileInfo + parentDir := filepath.Dir(dst) + if _, err := os.Stat(parentDir); os.IsNotExist(err) { + err := os.MkdirAll(parentDir, os.ModePerm) + if err != nil { + pterm.Error.Println("Failed to create temp copy directory:", err) + } + } if srcfd, err = os.Open(src); err != nil { return err }