~taiite/public-inbox

senpai: Add support for configuration in ~/.config on macOS v1 PROPOSED

~arcade: 1
 add support for ~/.config on macOS

 1 files changed, 14 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~taiite/public-inbox/patches/33714/mbox | git am -3
Learn more about email & git

[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