Skip to content

Commit

Permalink
config: seperate binary validation
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Feb 8, 2024
1 parent f20d672 commit df4aa2e
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,27 +132,35 @@ func (b *Binary) LauncherPath() (string, error) {
return exec.LookPath(strings.Fields(b.Launcher)[0])
}

func (b *Binary) setup() error {
if err := b.FFlags.SetRenderer(b.Renderer); err != nil {
return err
}

func (b *Binary) validate() error {
if !strings.HasPrefix(b.Renderer, "D3D11") && b.Dxvk {
return ErrNeedDXVKRenderer
}

if b.Launcher != "" {
if _, err := b.LauncherPath(); err != nil {
return err
return fmt.Errorf("bad launcher: %s", err)
}
}

if b.WineRoot != "" {
if _, err := wine.Wine64(b.WineRoot); err != nil {
return err
return fmt.Errorf("bad wineroot: %s", err)
}
}

return nil
}

func (b *Binary) setup() error {
if err := b.validate(); err != nil {
return fmt.Errorf("invalid: %w", err)
}

if err := b.FFlags.SetRenderer(b.Renderer); err != nil {
return err
}

return b.pickCard()
}

Expand Down

0 comments on commit df4aa2e

Please sign in to comment.