1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-16 17:35:57 -05:00
OpenDiablo2/d2core/d2config/default_directories.go
Tim Sarbin 236a091997
Merge pull request #1098 from willroberts/windows-path-support
Use filepath instead of path for Windows support
2021-03-24 08:55:20 -04:00

26 lines
604 B
Go

package d2config
import (
"os"
"path/filepath"
)
const (
od2ConfigDirName = "OpenDiablo2"
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 filepath.Join(configDir, od2ConfigDirName, od2ConfigFileName)
}
return LocalConfigPath()
}
// LocalConfigPath returns the absolute path to the directory of the OpenDiablo2 executable
func LocalConfigPath() string {
return filepath.Join(filepath.Dir(os.Args[0]), od2ConfigFileName)
}