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

Function GetDataDir

pkg/paths/paths.go:112–120  ·  view source on GitHub ↗

GetDataDir returns the user's data directory for docker agent (caches, content, logs). If an override has been set via [SetDataDir] it is returned instead. If the home directory cannot be determined, it falls back to a directory under the system temporary directory.

()

Source from the content-addressed store, hash-verified

110// If the home directory cannot be determined, it falls back to a directory
111// under the system temporary directory.
112func GetDataDir() string {
113 return dataDirOverride.get(func() string {
114 homeDir, err := os.UserHomeDir()
115 if err != nil {
116 return filepath.Clean(filepath.Join(os.TempDir(), ".cagent"))
117 }
118 return filepath.Clean(filepath.Join(homeDir, ".cagent"))
119 })
120}
121
122// GetHomeDir returns the user's home directory.
123//

Callers 15

DefaultDirFunction · 0.92
CreateToolSetFunction · 0.92
DefaultDirFunction · 0.92
TestSetRootFunction · 0.92
createPasteAttachmentFunction · 0.92
NewFunction · 0.92
ThemesDirFunction · 0.92
resolveCreateConfigFunction · 0.92
ResolveDatabasePathFunction · 0.92
ToolsDirFunction · 0.92
DefaultFunction · 0.92

Calls 1

getMethod · 0.45

Tested by 2

TestSetRootFunction · 0.74