kleinCommand/services/getConfigPath.go
darius 00748f4a88 config read + types added
Config added
config get from server
2024-05-24 20:32:42 +02:00

26 lines
503 B
Go

package services
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":
path = filepath.Dir(homeDir + "/.config/kleinCommand")
default:
return "", "", errors.New("unsupported platform")
}
configPath = filepath.Join(path, "/config.toml")
return path, configPath, nil
}