Unfuck asset manager init (#906)

* 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

View File

@ -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

View File

@ -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) {