MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / WalkPathFunc

Function WalkPathFunc

x/file.go:37–52  ·  view source on GitHub ↗

WalkPathFunc walks the directory 'dir' and collects all path names matched by func f. If the path is a directory, it will set the bool argument to true. Returns empty string slice if nothing found, otherwise returns all matched path names.

(dir string, f func(string, bool) bool)

Source from the content-addressed store, hash-verified

35// func f. If the path is a directory, it will set the bool argument to true.
36// Returns empty string slice if nothing found, otherwise returns all matched path names.
37func WalkPathFunc(dir string, f func(string, bool) bool) []string {
38 var list []string
39 err := filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error {
40 if err != nil {
41 return err
42 }
43 if f(path, fi.IsDir()) {
44 list = append(list, path)
45 }
46 return nil
47 })
48 if err != nil {
49 glog.Errorf("Error while scanning %q: %s", dir, err)
50 }
51 return list
52}
53
54// FindFilesFunc walks the directory 'dir' and collects all file names matched by
55// func f. It will skip over directories.

Callers 8

runBackupInternalFunction · 0.92
runBackupInternalFunction · 0.92
runBackupInternalFunction · 0.92
runBackupInternalFunction · 0.92
runBackupInternalFunction · 0.92
ListPathsMethod · 0.92
getLogFilesFunction · 0.92
FindFilesFuncFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by 5

runBackupInternalFunction · 0.74
runBackupInternalFunction · 0.74
runBackupInternalFunction · 0.74
runBackupInternalFunction · 0.74
runBackupInternalFunction · 0.74