GetCacheDir returns the user's cache directory for docker agent. If an override has been set via [SetCacheDir] it is returned instead. On Linux this follows XDG: $XDG_CACHE_HOME/cagent (default ~/.cache/cagent). On macOS this uses ~/Library/Caches/cagent. On Windows this uses %LocalAppData%/cagent
()
| 77 | // If the cache directory cannot be determined, it falls back to a directory |
| 78 | // under the system temporary directory. |
| 79 | func GetCacheDir() string { |
| 80 | return cacheDirOverride.get(func() string { |
| 81 | cacheDir, err := os.UserCacheDir() |
| 82 | if err != nil { |
| 83 | return filepath.Clean(filepath.Join(os.TempDir(), ".cagent-cache")) |
| 84 | } |
| 85 | return filepath.Clean(filepath.Join(cacheDir, "cagent")) |
| 86 | }) |
| 87 | } |
| 88 | |
| 89 | // GetConfigDir returns the user's config directory for docker agent. |
| 90 | // |