Added MkdirAll capabilities for Checkpoint's image-path.

Now able to save the state file (checkpoint.img) at an image-path that had
previously not existed. This is important because there can only be one
checkpoint.img file per directory so this will enable users to create as many
directories as needed for proper organization.

PiperOrigin-RevId: 202360414
Change-Id: If5dd2b72e08ab52834a2b605571186d107b64526
This commit is contained in:
Brielle Broder
2018-06-27 13:32:53 -07:00
committed by Shentubot
parent c186e408cc
commit f93043615f
+4
View File
@@ -81,6 +81,10 @@ func (c *Checkpoint) Execute(_ context.Context, f *flag.FlagSet, args ...interfa
Fatalf("image-path flag must be provided")
}
if err := os.MkdirAll(c.imagePath, 0755); err != nil {
Fatalf("error making directories at path provided: %v", err)
}
fullImagePath := filepath.Join(c.imagePath, checkpointFileName)
// Create the image file and open for writing.