1
0
forked from MTSR/mapserver

Add support for custom colors.txt dir (#334)

This commit is contained in:
Niklp 2023-09-28 07:00:04 +02:00 committed by GitHub
parent 073647a62a
commit 0fd52738d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View File

@ -129,6 +129,7 @@ func ParseConfig(filename string) (*Config, error) {
Skins: &skins,
WorldPath: "./",
DataPath: "./",
ColorsTxtPath: "./",
}
info, err := os.Stat(filename)

View File

@ -100,11 +100,11 @@ func Setup(p params.ParamsType, cfg *Config) *App {
}
//load provided colors, if available
info, err := os.Stat(filepath.Join(a.Config.DataPath, "colors.txt"))
info, err := os.Stat(filepath.Join(a.Config.ColorsTxtPath, "colors.txt"))
if info != nil && err == nil {
logrus.WithFields(logrus.Fields{"filename": "colors.txt"}).Info("Loading colors from filesystem")
data, err := os.ReadFile(filepath.Join(a.Config.DataPath, "colors.txt"))
data, err := os.ReadFile(filepath.Join(a.Config.ColorsTxtPath, "colors.txt"))
if err != nil {
panic(err)
}

View File

@ -26,6 +26,7 @@ type Config struct {
Skins *SkinsConfig `json:"skins"`
WorldPath string `json:"worldpath"`
DataPath string `json:"datapath"`
ColorsTxtPath string `json:colorstxtpath`
}
type MapBlockAccessorConfig struct {