MCPcopy Index your code
hub / github.com/docker/cli / Path

Function Path

cli/config/config.go:100–106  ·  view source on GitHub ↗

Path returns the path to a file relative to the config dir

(p ...string)

Source from the content-addressed store, hash-verified

98
99// Path returns the path to a file relative to the config dir
100func Path(p ...string) (string, error) {
101 path := filepath.Join(append([]string{Dir()}, p...)...)
102 if !strings.HasPrefix(path, Dir()+string(filepath.Separator)) {
103 return "", fmt.Errorf("path %q is outside of root config directory %q", path, Dir())
104 }
105 return path, nil
106}
107
108// LoadFromReader is a convenience function that creates a ConfigFile object from
109// a reader. It returns an error if configData is malformed.

Callers 1

TestConfigPathFunction · 0.70

Calls 1

DirFunction · 0.85

Tested by 1

TestConfigPathFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…