Skip to content

Commit

Permalink
Actually fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaz492 committed Jul 28, 2023
1 parent 5d4e7b8 commit 855ce86
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 855ce86

Please sign in to comment.