kleinCommand/common/getConfigPath.go

26 lines
508 B
Go
Raw Permalink Normal View History

2025-07-19 20:58:05 +02:00
package common
import (
"errors"
"os"
"path/filepath"
"runtime"
)
func GetConfigPath() (path string, configPath string, err error) {
homeDir, _ := os.UserHomeDir()
switch runtime.GOOS {
case "windows":
path = filepath.Dir(homeDir + "\\AppData\\Local\\kleinCommand\\")
case "linux":
2024-05-24 21:23:01 +02:00
path = filepath.Dir(homeDir + "/.config/kleinCommand/")
default:
return "", "", errors.New("unsupported platform")
}
2025-07-19 20:58:05 +02:00
configPath = filepath.Join(path, "/kleinCommand.toml")
return path, configPath, nil
}