MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / realOSPath

Function realOSPath

pkg/fetch/fetch.go:65–76  ·  view source on GitHub ↗

realOSPath replaces path root of p by r if r != "" and returns p otherwise. realOSPath assumes operating system paths and that both paths are cleaned.

(r, p string)

Source from the content-addressed store, hash-verified

63// realOSPath replaces path root of p by r if r != "" and returns p otherwise.
64// realOSPath assumes operating system paths and that both paths are cleaned.
65func realOSPath(r, p string) (string, error) {
66 if r == "" {
67 return p, nil
68 }
69 if !filepath.IsAbs(p) {
70 return filepath.Join(r, p), nil
71 }
72 if filepath.VolumeName(p) != "" {
73 return "", errVolumeSpecified.New()
74 }
75 return filepath.Join(r, p[1:]), nil
76}
77
78// Interface is an abstraction for file retrieval.
79type Interface interface {

Callers 1

FileMethod · 0.85

Calls 2

JoinMethod · 0.65
NewMethod · 0.65

Tested by

no test coverage detected