Skip to content

Commit

Permalink
os detection improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Jancis committed Apr 17, 2024
1 parent 51c75c0 commit 27062e0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions internal/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ import (
"os"
"os/user"
"path/filepath"
"runtime"

"github.com/spf13/viper"
)

func ConfigStore() viper.Viper {

// Configuration subpath based on OS
// Default configuration subpath
siltaConfigDir := ".config/silta"
if os := os.Getenv("OS"); os == "Windows_NT" {
siltaConfigDir = ".silta"

// running on Windows
if runtime.GOOS == "windows" {
siltaConfigDir = filepath.Join("AppData", "Local", "silta")
}
if os := os.Getenv("OS"); os == "darwin" {

// running on MacOS
if runtime.GOOS == "darwin" {
siltaConfigDir = "Library/Application Support/silta"
}

Expand Down

0 comments on commit 27062e0

Please sign in to comment.