Ensure parent directories are created for base boxes
This commit is contained in:
parent
8dcabe977d
commit
abe9bf8581
@ -39,6 +39,13 @@ func CopyContents(dst, src string) error {
|
|||||||
// actually a proper box. This is an expected precondition.
|
// actually a proper box. This is an expected precondition.
|
||||||
func DirToBox(dst, dir string, ui packer.Ui, level int) error {
|
func DirToBox(dst, dir string, ui packer.Ui, level int) error {
|
||||||
log.Printf("Turning dir into box: %s => %s", dir, dst)
|
log.Printf("Turning dir into box: %s => %s", dir, dst)
|
||||||
|
|
||||||
|
// Make the containing directory, if it does not already exist
|
||||||
|
err := os.MkdirAll(filepath.Dir(dst), 0755)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
dstF, err := os.Create(dst)
|
dstF, err := os.Create(dst)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user