Skip to content

Commit cd2d4ae

Browse files
committed
init
1 parent 0b83bcc commit cd2d4ae

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

internal/writer.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"os"
88
"path"
9+
"path/filepath"
910
"slices"
1011
"text/template"
1112
)
@@ -78,10 +79,12 @@ func (w *stdWriter) api(output string, name string, engine *template.Template) e
7879
}
7980

8081
output = tmpl.PwdJoinPath(output)
81-
dir := path.Dir(output)
82-
_ = os.MkdirAll(dir, os.ModePerm)
83-
84-
fmt.Printf("[output] %s \n", output)
82+
dir := filepath.Dir(output)
83+
err = os.MkdirAll(dir, os.ModePerm)
84+
if err != nil {
85+
return err
86+
}
87+
fmt.Printf("Output %s \n", output)
8588

8689
return os.WriteFile(output, buf.Bytes(), os.ModePerm)
8790
}
@@ -102,10 +105,12 @@ func (w *stdWriter) client(output string, name string, engine *template.Template
102105
}
103106

104107
output = tmpl.PwdJoinPath(output)
105-
dir := path.Dir(output)
106-
_ = os.MkdirAll(dir, os.ModePerm)
107-
108-
fmt.Printf("[client] %s \n", output)
108+
dir := filepath.Dir(output)
109+
err = os.MkdirAll(dir, os.ModePerm)
110+
if err != nil {
111+
return err
112+
}
113+
fmt.Printf("Output %s \n", output)
109114

110115
return os.WriteFile(output, buf.Bytes(), os.ModePerm)
111116
}

0 commit comments

Comments
 (0)