mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 23:47:16 -05:00
Unfuck asset manager init (#906)
* moved loader bootstrap logic into d2app
This commit is contained in:
parent
f2ab13afae
commit
be9c29e9d2
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user