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
()
| 59 | // |
| 60 | // [pkg/homedir.Get]: https://pkg.go.dev/github.com/docker/docker@v28.0.3+incompatible/pkg/homedir#Get |
| 61 | func 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. |
| 72 | type Provider interface { |