MCPcopy Index your code
hub / github.com/cortesi/devd / Less

Method Less

fileserver/fileserver.go:45–60  ·  view source on GitHub ↗
(i, j int)

Source from the content-addressed store, hash-verified

43}
44
45func (p fileSlice) Less(i, j int) bool {
46 a, b := p[i], p[j]
47 if a.IsDir() && !b.IsDir() {
48 return true
49 }
50 if b.IsDir() && !a.IsDir() {
51 return false
52 }
53 if strings.HasPrefix(a.Name(), ".") && !strings.HasPrefix(b.Name(), ".") {
54 return false
55 }
56 if strings.HasPrefix(b.Name(), ".") && !strings.HasPrefix(a.Name(), ".") {
57 return true
58 }
59 return a.Name() < b.Name()
60}
61
62func (p fileSlice) Swap(i, j int) {
63 p[i], p[j] = p[j], p[i]

Callers

nothing calls this directly

Calls 2

IsDirMethod · 0.80
NameMethod · 0.80

Tested by

no test coverage detected