1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-03 14:30:42 +00:00
OpenDiablo2/d2core/d2config/default_directories.go
gravestench 5ac03d6f49
refactored game bootstrap, removed d2config.Config singleton (#899)
* Remove d2config.Config singleton

* refactored config file bootstrap
* `d2loader.Loader` adds the config directories during init
* `d2asset.AssetManager` loads the config file during init
* mpq verification logic removed from d2config; this is done by d2loader
* added `errorMessage` to `d2app.App` for setting the error message for the error screen.

* fixed loader test
2020-11-03 07:54:15 -05:00

29 lines
593 B
Go

package d2config
import (
"os"
"path"
)
const (
od2ConfigDirName = "OpenDiablo2"
)
const (
od2ConfigFileName = "config.json"
)
// DefaultConfigPath returns the absolute path for the default config file location
func DefaultConfigPath() string {
if configDir, err := os.UserConfigDir(); err == nil {
return path.Join(configDir, od2ConfigDirName, od2ConfigFileName)
}
return LocalConfigPath()
}
// LocalConfigPath returns the absolute path to the directory of the OpenDiablo2 executable
func LocalConfigPath() string {
return path.Join(path.Dir(os.Args[0]), od2ConfigFileName)
}