Skip to content

Commit

Permalink
Remove null category when generating
Browse files Browse the repository at this point in the history
trim the slash from paths like /gen8/shiny/froakie.cow,
to ensure that there is no empty category in first position
  • Loading branch information
tmck-code committed Apr 5, 2023
1 parent 975bd83 commit e5cc302
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pokedex/pokedex.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,21 @@ func CreateCategoryStruct(rootDir string, metadata []PokemonMetadata, debug bool
"build/assets/categories/%s",
cat,
)
fpath := fmt.Sprintf("%s/%02d%s", destDir, i, ".cat")
os.MkdirAll(destDir, 0755)
WriteBytesToFile([]byte(fmt.Sprintf("%d/%d", i, j)), fmt.Sprintf("%s/%02d%s", destDir, i, ".cat"), false)
WriteBytesToFile(
[]byte(fmt.Sprintf("%d/%d", i, j)),
fpath,
false,
)
}
}
}
return GatherMapKeys(uniqueCategories)
}

func createCategories(fpath string, data []byte) []string {
parts := strings.Split(fpath, "/")
parts := strings.Split(strings.TrimLeft(fpath, "/"), "/")
height := sizeCategory(len(strings.Split(string(data), "\n")))

return append([]string{height}, parts[0:len(parts)-1]...)
Expand Down

0 comments on commit e5cc302

Please sign in to comment.