1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2025-02-20 23:47:16 -05:00

Unfuck asset manager init ()

* moved loader bootstrap logic into d2app
This commit is contained in:
gravestench 2020-11-08 09:24:35 +00:00 committed by GitHub
parent f2ab13afae
commit be9c29e9d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions
d2app
d2common/d2loader

@ -287,6 +287,10 @@ func (a *App) LoadConfig() (*d2config.Configuration, error) {
func (a *App) Run() error { func (a *App) Run() error {
a.parseArguments() a.parseArguments()
// add our possible config directories
_, _ = a.asset.AddSource(filepath.Dir(d2config.LocalConfigPath()))
_, _ = a.asset.AddSource(filepath.Dir(d2config.DefaultConfigPath()))
config, err := a.LoadConfig() config, err := a.LoadConfig()
if err != nil { if err != nil {
return err return err

@ -43,8 +43,6 @@ func NewLoader(l d2util.LogLevel) (*Loader, error) {
loader.Logger.SetPrefix(logPrefix) loader.Logger.SetPrefix(logPrefix)
loader.Logger.SetLevel(l) loader.Logger.SetLevel(l)
loader.bootstrap()
return loader, nil return loader, nil
} }
@ -57,11 +55,6 @@ type Loader struct {
Sources []asset.Source Sources []asset.Source
} }
func (l *Loader) bootstrap() {
_, _ = l.AddSource(filepath.Dir(d2config.LocalConfigPath()))
_, _ = l.AddSource(filepath.Dir(d2config.DefaultConfigPath()))
}
// Load attempts to load an asset with the given sub-path. The sub-path is relative to the root // Load attempts to load an asset with the given sub-path. The sub-path is relative to the root
// of each asset source root (regardless of the type of asset source) // of each asset source root (regardless of the type of asset source)
func (l *Loader) Load(subPath string) (asset.Asset, error) { func (l *Loader) Load(subPath string) (asset.Asset, error) {