Files
honoka-chan/internal/utils/serverdata.go
T
2026-06-05 06:53:48 +08:00

17 lines
339 B
Go

package utils
import (
"encoding/json"
"honoka-chan/pkg/utils"
"path/filepath"
)
const serverDataPath = "assets/serverdata"
func LoadServerData[T any](fileName string) (T, error) {
var data T
filePath := filepath.Join(serverDataPath, fileName)
err := json.Unmarshal([]byte(utils.ReadAllText(filePath)), &data)
return data, err
}