MCPcopy
hub / github.com/crowdsecurity/crowdsec / listFilesAtPath

Function listFilesAtPath

pkg/csplugin/listfiles.go:9–21  ·  view source on GitHub ↗

helper which gives paths to all files in the given directory non-recursively

(path string)

Source from the content-addressed store, hash-verified

7
8// helper which gives paths to all files in the given directory non-recursively
9func listFilesAtPath(path string) ([]string, error) {
10 filePaths := make([]string, 0)
11 files, err := os.ReadDir(path)
12 if err != nil {
13 return nil, err
14 }
15 for _, file := range files {
16 if !file.IsDir() {
17 filePaths = append(filePaths, filepath.Join(path, file.Name()))
18 }
19 }
20 return filePaths, nil
21}

Callers 3

loadConfigMethod · 0.85
loadPluginsMethod · 0.85
TestListFilesAtPathFunction · 0.85

Calls 1

NameMethod · 0.45

Tested by 1

TestListFilesAtPathFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…