build: directory creation

This now precreates the directory as it's possible that the directory
doesn't exist yet at this point; see #94.

Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This commit is contained in:
Simon de Vlieger 2025-01-29 09:47:01 +01:00
parent a5f5b48293
commit 34de7d7ce5

View file

@ -28,6 +28,9 @@ func buildImage(res *imagefilter.Result, osbuildManifest []byte, opts *buildOpti
}
if opts.WriteManifest {
p := filepath.Join(opts.OutputDir, fmt.Sprintf("%s.osbuild-manifest.json", outputNameFor(res)))
if err := os.MkdirAll(filepath.Dir(p), 0755); err != nil {
return err
}
if err := os.WriteFile(p, osbuildManifest, 0644); err != nil {
return err
}