mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-11 19:17:09 -05:00
Add OSX support for path fixups. (#251)
This commit is contained in:
parent
a194913609
commit
4eeac5c1d9
13
config.json
13
config.json
@ -20,5 +20,18 @@
|
||||
"d2sfx.mpq",
|
||||
"d2video.mpq",
|
||||
"d2speech.mpq"
|
||||
],
|
||||
"MpqMacLoadOrder": [
|
||||
"Diablo II Patch",
|
||||
"Diablo II Expansion Data",
|
||||
"Diablo II Expansion Movies",
|
||||
"Diablo II Expansion Music",
|
||||
"Diablo II Expansion Speech",
|
||||
"Diablo II Game Data",
|
||||
"Diablo II Graphics",
|
||||
"Diablo II Movies",
|
||||
"Diablo II Music",
|
||||
"Diablo II Sounds",
|
||||
"Diablo II Speech"
|
||||
]
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/mitchellh/go-homedir"
|
||||
@ -22,6 +23,7 @@ type Configuration struct {
|
||||
VsyncEnabled bool
|
||||
MpqPath string
|
||||
MpqLoadOrder []string
|
||||
MpqMacLoadOrder []string
|
||||
SfxVolume float64
|
||||
BgmVolume float64
|
||||
}
|
||||
@ -39,6 +41,12 @@ func LoadConfiguration() *Configuration {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if runtime.GOOS == "darwin" {
|
||||
if config.MpqPath[0] != '/' {
|
||||
config.MpqPath = "/Applications/Diablo II/"
|
||||
}
|
||||
config.MpqLoadOrder = config.MpqMacLoadOrder
|
||||
} else {
|
||||
// Path fixup for wine-installed diablo 2 in linux
|
||||
if config.MpqPath[0] != '/' {
|
||||
if _, err := os.Stat(config.MpqPath); os.IsNotExist(err) {
|
||||
@ -51,5 +59,8 @@ func LoadConfiguration() *Configuration {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return &config
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user