MCPcopy Index your code
hub / github.com/helm/helm / GetLocalPath

Function GetLocalPath

internal/resolver/resolver.go:242–263  ·  view source on GitHub ↗

GetLocalPath generates absolute local path when use "file://" in repository of dependencies

(repo, chartpath string)

Source from the content-addressed store, hash-verified

240// GetLocalPath generates absolute local path when use
241// "file://" in repository of dependencies
242func GetLocalPath(repo, chartpath string) (string, error) {
243 var depPath string
244 var err error
245 p := strings.TrimPrefix(repo, "file://")
246
247 // root path is absolute
248 if strings.HasPrefix(p, "/") {
249 if depPath, err = filepath.Abs(p); err != nil {
250 return "", err
251 }
252 } else {
253 depPath = filepath.Join(chartpath, p)
254 }
255
256 if _, err = os.Stat(depPath); errors.Is(err, fs.ErrNotExist) {
257 return "", fmt.Errorf("directory %s not found", depPath)
258 } else if err != nil {
259 return "", err
260 }
261
262 return depPath, nil
263}

Callers 4

resolveRepoNamesMethod · 0.92
tarFromLocalDirFunction · 0.92
TestGetLocalPathFunction · 0.85
ResolveMethod · 0.85

Calls 1

IsMethod · 0.80

Tested by 1

TestGetLocalPathFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…