(goos string)
| 108 | } |
| 109 | |
| 110 | func 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. |
| 137 | func getCacheDir() string { |
no outgoing calls
no test coverage detected