A Minecraft datapack generator written in go.

fix: generator not creating directories before the file

+8 -1
+1
.gitignore
··· 1 + out/
+7 -1
internal/generator/generator.go
··· 3 3 import ( 4 4 "os" 5 5 "path" 6 + "path/filepath" 7 + "strings" 6 8 ) 7 9 8 10 // todo: transform this to use concurrency ··· 13 15 return err 14 16 } 15 17 16 - path := path.Join(outputDirectory, namespace, file.Path) 18 + path := path.Join(outputDirectory, namespace, strings.ReplaceAll(file.Path, "%namespace%",namespace)) 17 19 if err := writeFile(path, file.Content); err != nil { 18 20 return err 19 21 } ··· 22 24 } 23 25 24 26 func writeFile(path string, content []byte) error { 27 + if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { 28 + return err 29 + } 30 + 25 31 file, err := os.Create(path) 26 32 if err != nil { 27 33 return err