1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-10-31 16:27:18 -04:00

Add OSX support for path fixups. (#251)

This commit is contained in:
Tim Sarbin 2019-12-14 00:15:52 -05:00 committed by GitHub
parent a194913609
commit 4eeac5c1d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 10 deletions

View File

@ -20,5 +20,18 @@
"d2sfx.mpq", "d2sfx.mpq",
"d2video.mpq", "d2video.mpq",
"d2speech.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"
] ]
} }

View File

@ -6,6 +6,7 @@ import (
"log" "log"
"os" "os"
"path" "path"
"runtime"
"strings" "strings"
"github.com/mitchellh/go-homedir" "github.com/mitchellh/go-homedir"
@ -22,6 +23,7 @@ type Configuration struct {
VsyncEnabled bool VsyncEnabled bool
MpqPath string MpqPath string
MpqLoadOrder []string MpqLoadOrder []string
MpqMacLoadOrder []string
SfxVolume float64 SfxVolume float64
BgmVolume float64 BgmVolume float64
} }
@ -39,6 +41,12 @@ func LoadConfiguration() *Configuration {
if err != nil { if err != nil {
log.Fatal(err) 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 // Path fixup for wine-installed diablo 2 in linux
if config.MpqPath[0] != '/' { if config.MpqPath[0] != '/' {
if _, err := os.Stat(config.MpqPath); os.IsNotExist(err) { if _, err := os.Stat(config.MpqPath); os.IsNotExist(err) {
@ -51,5 +59,8 @@ func LoadConfiguration() *Configuration {
} }
} }
} }
}
return &config return &config
} }