Skip to content

Commit

Permalink
Change order predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
lucat1 authored May 9, 2022
2 parents 53631a3 + 05ac19c commit 16b8081
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion statik.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ func generate(dir string) bool {
}
if sortEntries {
sort.Slice(entries, func(i, j int) bool {
return entries[i].IsDir() && !entries[j].IsDir()
isFirstEntryDir := entries[i].IsDir()
isSecondEntryDir := entries[j].IsDir()
return isFirstEntryDir && !isSecondEntryDir ||
(isFirstEntryDir || !isSecondEntryDir) &&
entries[i].Name() < entries[j].Name()
})
}

Expand Down

0 comments on commit 16b8081

Please sign in to comment.