Skip to content

Commit

Permalink
output: ensure the directory exists
Browse files Browse the repository at this point in the history
When using +output:dir=./something and attempting to write a nested
path, the current implementation does not work.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
  • Loading branch information
stevekuznetsov committed Oct 3, 2022
1 parent 24d788a commit e6e9dbd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/genall/output.go
Expand Up @@ -103,7 +103,7 @@ type OutputToDirectory string

func (o OutputToDirectory) Open(_ *loader.Package, itemPath string) (io.WriteCloser, error) {
// ensure the directory exists
if err := os.MkdirAll(string(o), os.ModePerm); err != nil {
if err := os.MkdirAll(filepath.Dir(filepath.Join(string(o), itemPath)), os.ModePerm); err != nil {
return nil, err
}
path := filepath.Join(string(o), itemPath)
Expand Down

0 comments on commit e6e9dbd

Please sign in to comment.