MCPcopy Create free account
hub / github.com/docker/cli / getHomeDir

Function getHomeDir

cli/config/config.go:61–69  ·  view source on GitHub ↗

getHomeDir returns the home directory of the current user with the help of environment variables depending on the target operating system. Returned path should be used with "path/filepath" to form new paths. On non-Windows platforms, it falls back to nss lookups, if the home directory cannot be obt

()

Source from the content-addressed store, hash-verified

59//
60// [pkg/homedir.Get]: https://pkg.go.dev/github.com/docker/docker@v28.0.3+incompatible/pkg/homedir#Get
61func getHomeDir() string {
62 home, _ := os.UserHomeDir()
63 if home == "" && runtime.GOOS != "windows" {
64 if u, err := user.Current(); err == nil {
65 return u.HomeDir
66 }
67 }
68 return home
69}
70
71// Provider defines an interface for providing the CLI config.
72type Provider interface {

Callers 1

DirFunction · 0.85

Calls 1

CurrentMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…