MCPcopy Create free account
hub / github.com/gogs/gogs / FileNames

Function FileNames

conf/embed.go:12–23  ·  view source on GitHub ↗

FileNames returns a list of filenames exists in the given direction within Files. The list includes names of subdirectories.

(dir string)

Source from the content-addressed store, hash-verified

10// FileNames returns a list of filenames exists in the given direction within
11// Files. The list includes names of subdirectories.
12func FileNames(dir string) ([]string, error) {
13 entries, err := Files.ReadDir(dir)
14 if err != nil {
15 return nil, err
16 }
17
18 fileNames := make([]string, 0, len(entries))
19 for _, entry := range entries {
20 fileNames = append(fileNames, entry.Name())
21 }
22 return fileNames, nil
23}

Callers 1

TestFileNamesFunction · 0.85

Calls 2

appendFunction · 0.85
NameMethod · 0.45

Tested by 1

TestFileNamesFunction · 0.68