MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / getConfigDirForOS

Function getConfigDirForOS

internal/config/files.go:110–134  ·  view source on GitHub ↗
(goos string)

Source from the content-addressed store, hash-verified

108}
109
110func getConfigDirForOS(goos string) string {
111 const windowsOS = "windows"
112 switch goos {
113 case windowsOS:
114 // Windows: Use %APPDATA% (Roaming) for config files
115 if appData := os.Getenv("APPDATA"); appData != "" {
116 return filepath.Join(appData, "pvetui")
117 }
118 // Fallback to user home directory
119 if homeDir, err := os.UserHomeDir(); err == nil {
120 return filepath.Join(homeDir, "AppData", "Roaming", "pvetui")
121 }
122 default:
123 // macOS, Linux, and other Unix-like systems: Use XDG Base Directory Specification
124 if xdgConfig := os.Getenv("XDG_CONFIG_HOME"); xdgConfig != "" {
125 return filepath.Join(xdgConfig, "pvetui")
126 }
127 if homeDir, err := os.UserHomeDir(); err == nil {
128 return filepath.Join(homeDir, ".config", "pvetui")
129 }
130 }
131
132 // Ultimate fallback
133 return filepath.Join(".config", "pvetui")
134}
135
136// getCacheDir returns the appropriate cache directory path for the current platform.
137func getCacheDir() string {

Callers 2

getConfigDirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected