Fix relative config path #171

This commit is contained in:
Alexey Khit
2023-01-16 10:59:33 +03:00
parent d23d2a7eff
commit 7a0091777d
+4 -2
View File
@@ -8,7 +8,7 @@ import (
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"io" "io"
"os" "os"
"path" "path/filepath"
"runtime" "runtime"
"strings" "strings"
) )
@@ -52,8 +52,10 @@ func Init() {
} }
if ConfigPath != "" { if ConfigPath != "" {
if !filepath.IsAbs(ConfigPath) {
if cwd, err := os.Getwd(); err == nil { if cwd, err := os.Getwd(); err == nil {
ConfigPath = path.Join(cwd, ConfigPath) ConfigPath = filepath.Join(cwd, ConfigPath)
}
} }
Info["config_path"] = ConfigPath Info["config_path"] = ConfigPath
} }