From be9c29e9d2d9ef49bd9aa267bb3c832208c0f31c Mon Sep 17 00:00:00 2001 From: gravestench Date: Sun, 8 Nov 2020 09:24:35 +0000 Subject: [PATCH] Unfuck asset manager init (#906) * moved loader bootstrap logic into d2app --- d2app/app.go | 4 ++++ d2common/d2loader/loader.go | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/d2app/app.go b/d2app/app.go index 8e7429f1..2853028b 100644 --- a/d2app/app.go +++ b/d2app/app.go @@ -287,6 +287,10 @@ func (a *App) LoadConfig() (*d2config.Configuration, error) { func (a *App) Run() error { 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() if err != nil { return err diff --git a/d2common/d2loader/loader.go b/d2common/d2loader/loader.go index 00cc823c..27fe7d0e 100644 --- a/d2common/d2loader/loader.go +++ b/d2common/d2loader/loader.go @@ -43,8 +43,6 @@ func NewLoader(l d2util.LogLevel) (*Loader, error) { loader.Logger.SetPrefix(logPrefix) loader.Logger.SetLevel(l) - loader.bootstrap() - return loader, nil } @@ -57,11 +55,6 @@ type Loader struct { 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 // of each asset source root (regardless of the type of asset source) func (l *Loader) Load(subPath string) (asset.Asset, error) {