Fix so that ending slash doesn't matter for characters path
All checks were successful
Build / build (push) Successful in 40s
All checks were successful
Build / build (push) Successful in 40s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -8,6 +9,10 @@ import (
|
||||
|
||||
func GetCharacterList() []string {
|
||||
charactersPath := os.Getenv("CHARACTERS_PATH")
|
||||
fmt.Printf("dir: %s\n", charactersPath)
|
||||
if !strings.HasSuffix(charactersPath, "/") {
|
||||
charactersPath += "/"
|
||||
}
|
||||
files, err := os.ReadDir(charactersPath)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -24,7 +29,11 @@ func GetCharacterList() []string {
|
||||
|
||||
func GetCharacter(character string) string {
|
||||
charactersPath := os.Getenv("CHARACTERS_PATH")
|
||||
return charactersPath + "/" + character
|
||||
fmt.Printf("dir: %s\n", charactersPath)
|
||||
if !strings.HasSuffix(charactersPath, "/") {
|
||||
charactersPath += "/"
|
||||
}
|
||||
return charactersPath + character
|
||||
}
|
||||
|
||||
func isImage(entry os.DirEntry) bool {
|
||||
|
||||
Reference in New Issue
Block a user