Skip to content

Commit

Permalink
Create archive directory if it doesn't exist.
Browse files Browse the repository at this point in the history
On an M1 Mac rename seems to fail if the containing directories do not
already exist.
  • Loading branch information
cmacknz committed Aug 31, 2022
1 parent 712b300 commit 91953bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -894,8 +894,10 @@ func movePackagesToArchive(dropPath string, requiredPackages []string) string {
continue
}

targetPath := filepath.Join(archivePath, rp)
if err := os.Rename(f, filepath.Join(targetPath, filepath.Base(f))); err != nil {
targetDir := filepath.Join(archivePath, rp, filepath.Base(f))
targetPath := filepath.Join(targetDir, filepath.Base(f))
os.MkdirAll(targetDir, 0755)
if err := os.Rename(f, targetPath); err != nil {
panic(errors.Wrap(err, "failed renaming file"))
}
}
Expand Down

0 comments on commit 91953bc

Please sign in to comment.