Wire everything together, now it's amen

This commit is contained in:
2024-11-06 00:40:28 +01:00
parent 0cdc57bf9a
commit 7a04d16a2e
4 changed files with 49 additions and 24 deletions

View File

@@ -4,6 +4,7 @@ import (
_ "embed"
"fmt"
"os"
"path/filepath"
"text/template"
)
@@ -44,12 +45,12 @@ type (
func (f *Function) ResolveFileName() string {
return f.Name + ".lua"
}
func (f *Function) WriteFile() error {
func (f *Function) WriteFile(root string) error {
if f.Name == "" {
return fmt.Errorf("function name is empty of %+v", f)
}
file, err := os.Create(f.ResolveFileName())
file, err := os.Create(filepath.Join(root, f.ResolveFileName()))
if err != nil {
return err
}