MCPcopy Index your code
hub / github.com/docker/docker-agent / GetCacheDir

Function GetCacheDir

pkg/paths/paths.go:79–87  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

77// If the cache directory cannot be determined, it falls back to a directory
78// under the system temporary directory.
79func 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//

Callers 4

BuildFunction · 0.92
TestSetRootFunction · 0.92
LoadFunction · 0.92
cacheFilePathFunction · 0.92

Calls 1

getMethod · 0.45

Tested by 1

TestSetRootFunction · 0.74