add error message if config not found

This commit is contained in:
onyx-and-iris 2022-09-18 20:57:59 +01:00
parent 73893209a1
commit a5f653f569

View File

@ -3,8 +3,8 @@ package main
import ( import (
"fmt" "fmt"
"log" "log"
"time"
"os" "os"
"time"
"github.com/onyx-and-iris/voicemeeter-api-go" "github.com/onyx-and-iris/voicemeeter-api-go"
@ -92,12 +92,12 @@ func vmConnect() (*voicemeeter.Remote, error) {
return vm, nil return vm, nil
} }
func obsConnect() (*goobs.Client, error) { func obsConnect() (*goobs.Client, error) {
type ( type (
connection struct { connection struct {
Host string Host string
Port int Port int
Password string Password string
} }
config struct { config struct {
@ -107,7 +107,8 @@ func obsConnect() (*goobs.Client, error) {
f := "config.toml" f := "config.toml"
if _, err := os.Stat(f); err != nil { if _, err := os.Stat(f); err != nil {
f = "./config.toml" err := fmt.Errorf("unable to locate %s", f)
return nil, err
} }
var c config var c config