aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas FitzRoy-Dale <nicholas@fitzroydale.org>2024-04-23 12:45:37 +0100
committerSimon Garrelou <simon@sixfoisneuf.fr>2024-04-24 21:31:25 +0200
commitc44247ccc39c0ce42473abcc379fb33c2d1151f4 (patch)
tree31296f33315cab670e64a32d19a332f26420a806
parent7a3aabee59e1a427aff755fc69759265ad9d0adc (diff)
downloadtermsonic-main.tar.gz
termsonic-main.zip
Support macOS configuration directoryHEADmain
-rw-r--r--src/config.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/config.go b/src/config.go
index 8f931ae..c8eae28 100644
--- a/src/config.go
+++ b/src/config.go
@@ -70,6 +70,16 @@ func getConfigFilePath() (string, error) {
70 os.MkdirAll(path, os.ModeDir.Perm()) 70 os.MkdirAll(path, os.ModeDir.Perm())
71 71
72 path = filepath.Join(path, "termsonic.toml") 72 path = filepath.Join(path, "termsonic.toml")
73 } else if runtime.GOOS == "darwin" {
74 home := os.Getenv("HOME")
75 if home == "" {
76 return "", fmt.Errorf("could not get home directory")
77 }
78
79 path = filepath.Join(home, "Library", "Application Support", "Termsonic")
80 os.MkdirAll(path, os.ModeDir.Perm() | 0700)
81
82 path = filepath.Join(path, "termsonic.toml")
73 } else { 83 } else {
74 return "", fmt.Errorf("unsupported operating system: %s", runtime.GOOS) 84 return "", fmt.Errorf("unsupported operating system: %s", runtime.GOOS)
75 } 85 }