MCPcopy Index your code
hub / github.com/Shopify/go-lua / searchPath

Function searchPath

load.go:89–105  ·  view source on GitHub ↗
(l *State, name, path, sep, dirSep string)

Source from the content-addressed store, hash-verified

87}
88
89func searchPath(l *State, name, path, sep, dirSep string) (string, error) {
90 var msg string
91 if sep != "" {
92 name = strings.Replace(name, sep, dirSep, -1) // Replace sep by dirSep.
93 }
94 path = strings.Replace(path, string(pathListSeparator), string(filepath.ListSeparator), -1)
95 for _, template := range filepath.SplitList(path) {
96 if template != "" {
97 filename := strings.Replace(template, "?", name, -1)
98 if readable(filename) {
99 return filename, nil
100 }
101 msg = fmt.Sprintf("%s\n\tno file '%s'", msg, filename)
102 }
103 }
104 return "", errors.New(msg)
105}
106
107func noEnv(l *State) bool {
108 l.Field(RegistryIndex, "LUA_NOENV")

Callers 2

findFileFunction · 0.85
load.goFile · 0.85

Calls 2

readableFunction · 0.85
ReplaceMethod · 0.80

Tested by

no test coverage detected