on Windows, do not look for configuration in linux paths (#5036)
Some checks failed
code_lint / go (push) Has been cancelled
code_lint / go_mod (push) Has been cancelled
code_lint / docs (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_e2e (push) Has been cancelled

This commit is contained in:
Alessandro Ros 2025-09-27 13:36:04 +02:00 committed by GitHub
parent 8e6cc4fab4
commit ada39d22cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,6 +44,9 @@ var version []byte
var defaultConfPaths = []string{ var defaultConfPaths = []string{
"rtsp-simple-server.yml", "rtsp-simple-server.yml",
"mediamtx.yml", "mediamtx.yml",
}
var defaultConfPathsNotWin = []string{
"/usr/local/etc/mediamtx.yml", "/usr/local/etc/mediamtx.yml",
"/usr/etc/mediamtx.yml", "/usr/etc/mediamtx.yml",
"/etc/mediamtx/mediamtx.yml", "/etc/mediamtx/mediamtx.yml",
@ -143,7 +146,12 @@ func New(args []string) (*Core, bool) {
tempLogger, _ := logger.New(logger.Warn, []logger.Destination{logger.DestinationStdout}, "", "") tempLogger, _ := logger.New(logger.Warn, []logger.Destination{logger.DestinationStdout}, "", "")
p.conf, p.confPath, err = conf.Load(cli.Confpath, defaultConfPaths, tempLogger) confPaths := append([]string(nil), defaultConfPaths...)
if runtime.GOOS != "windows" {
confPaths = append(confPaths, defaultConfPathsNotWin...)
}
p.conf, p.confPath, err = conf.Load(cli.Confpath, confPaths, tempLogger)
if err != nil { if err != nil {
fmt.Printf("ERR: %s\n", err) fmt.Printf("ERR: %s\n", err)
return nil, false return nil, false