From 43bc9cadd1098205c81ed767b7c52fc94c292540 Mon Sep 17 00:00:00 2001 From: Alexey Yerin Date: Thu, 29 Apr 2021 13:05:41 +0300 Subject: Use path.Join to construct config file path It would make it work on non-Unix systems and also handle things like .. in the configuration option --- cmd/senpai/main.go | 3 ++- cmd/test/main.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/senpai/main.go b/cmd/senpai/main.go index 5f7933d..d428ccf 100644 --- a/cmd/senpai/main.go +++ b/cmd/senpai/main.go @@ -5,6 +5,7 @@ import ( "log" "math/rand" "os" + "path" "time" "git.sr.ht/~taiite/senpai" @@ -29,7 +30,7 @@ func main() { if err != nil { log.Panicln(err) } - configPath = configDir + "/senpai/senpai.yaml" + configPath = path.Join(configDir, "senpai", "senpai.yaml") } cfg, err := senpai.LoadConfigFile(configPath) diff --git a/cmd/test/main.go b/cmd/test/main.go index 05257f8..6ed7f4e 100644 --- a/cmd/test/main.go +++ b/cmd/test/main.go @@ -7,6 +7,7 @@ import ( "io" "net" "os" + "path" "git.sr.ht/~taiite/senpai" "git.sr.ht/~taiite/senpai/irc" @@ -110,7 +111,7 @@ func parseFlags() { if err != nil { panic(err) } - configPath = configDir + "/senpai/senpai.yaml" + configPath = path.Join(configDir, "senpai", "senpai.yaml") } cfg, err := senpai.LoadConfigFile(configPath) -- cgit v1.2.3