| 290 | } |
| 291 | |
| 292 | func cacheDir() string { |
| 293 | if d := os.Getenv("CBM_CACHE_DIR"); d != "" { |
| 294 | return d |
| 295 | } |
| 296 | switch runtime.GOOS { |
| 297 | case "windows": |
| 298 | if d := os.Getenv("LOCALAPPDATA"); d != "" { |
| 299 | return filepath.Join(d, "codebase-memory-mcp") |
| 300 | } |
| 301 | case "darwin": |
| 302 | if home, err := os.UserHomeDir(); err == nil { |
| 303 | return filepath.Join(home, "Library", "Caches", "codebase-memory-mcp") |
| 304 | } |
| 305 | } |
| 306 | if d := os.Getenv("XDG_CACHE_HOME"); d != "" { |
| 307 | return filepath.Join(d, "codebase-memory-mcp") |
| 308 | } |
| 309 | if home, err := os.UserHomeDir(); err == nil { |
| 310 | return filepath.Join(home, ".cache", "codebase-memory-mcp") |
| 311 | } |
| 312 | return filepath.Join(os.TempDir(), "codebase-memory-mcp") |
| 313 | } |
| 314 | |
| 315 | func goos() string { |
| 316 | switch runtime.GOOS { |