From c44247ccc39c0ce42473abcc379fb33c2d1151f4 Mon Sep 17 00:00:00 2001 From: Nicholas FitzRoy-Dale Date: Tue, 23 Apr 2024 12:45:37 +0100 Subject: Support macOS configuration directory --- src/config.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/config.go b/src/config.go index 8f931ae..c8eae28 100644 --- a/src/config.go +++ b/src/config.go @@ -69,6 +69,16 @@ func getConfigFilePath() (string, error) { path = filepath.Join(appdata, "Termsonic") os.MkdirAll(path, os.ModeDir.Perm()) + path = filepath.Join(path, "termsonic.toml") + } else if runtime.GOOS == "darwin" { + home := os.Getenv("HOME") + if home == "" { + return "", fmt.Errorf("could not get home directory") + } + + path = filepath.Join(home, "Library", "Application Support", "Termsonic") + os.MkdirAll(path, os.ModeDir.Perm() | 0700) + path = filepath.Join(path, "termsonic.toml") } else { return "", fmt.Errorf("unsupported operating system: %s", runtime.GOOS) -- cgit v1.2.3