[PATCH senpai 1/1] add support for ~/.config on macOS
Export this patch
From: Arcade Wise <l3gacy.b3ta@disroot.org>
---
cmd/senpai/main.go | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/cmd/senpai/main.go b/cmd/senpai/main.go
index d177a8b..abc9dae 100644
--- a/cmd/senpai/main.go
+++ b/cmd/senpai/main.go
@@ -7,6 +7,7 @@ import (
"os"
"os/signal"
"path"
+ "runtime"
"strings"
"syscall"
"time"
@@ -25,11 +26,20 @@ func main() {
flag.Parse()
if configPath == "" {
- configDir, err := os.UserConfigDir()
- if err != nil {
- panic(err)
+ if runtime.GOOS == "darwin" {
+ home, err := os.UserHomeDir()
+ if err != nil {
+ panic(err)
+ }
+
+ configPath = path.Join(home, ".config", "senpai", "senpai.scfg")
+ } else {
+ configDir, err := os.UserConfigDir()
+ if err != nil {
+ panic(err)
+ }
+ configPath = path.Join(configDir, "senpai", "senpai.scfg")
}
- configPath = path.Join(configDir, "senpai", "senpai.scfg")
}
cfg, err := senpai.LoadConfigFile(configPath)
--
2.34.2