commit 43bc9ca
Alexey Yerin
·
2021-04-29 10:05:41 +0000 UTC
parent b455cc9
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
2 files changed,
+4,
-2
+2,
-1
1@@ -5,6 +5,7 @@ import (
2 "log"
3 "math/rand"
4 "os"
5+ "path"
6 "time"
7
8 "git.sr.ht/~taiite/senpai"
9@@ -29,7 +30,7 @@ func main() {
10 if err != nil {
11 log.Panicln(err)
12 }
13- configPath = configDir + "/senpai/senpai.yaml"
14+ configPath = path.Join(configDir, "senpai", "senpai.yaml")
15 }
16
17 cfg, err := senpai.LoadConfigFile(configPath)
+2,
-1
1@@ -7,6 +7,7 @@ import (
2 "io"
3 "net"
4 "os"
5+ "path"
6
7 "git.sr.ht/~taiite/senpai"
8 "git.sr.ht/~taiite/senpai/irc"
9@@ -110,7 +111,7 @@ func parseFlags() {
10 if err != nil {
11 panic(err)
12 }
13- configPath = configDir + "/senpai/senpai.yaml"
14+ configPath = path.Join(configDir, "senpai", "senpai.yaml")
15 }
16
17 cfg, err := senpai.LoadConfigFile(configPath)