Skip to content

Commit

Permalink
Remove unnecessary code when sorting by extension
Browse files Browse the repository at this point in the history
  • Loading branch information
joelim-work committed Oct 8, 2024
1 parent 1c56620 commit d36c8cb
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions nav.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,7 @@ func (dir *dir) sort() {
case extSort:
sort.SliceStable(dir.files, func(i, j int) bool {
ext1, ext2 := normalize(dir.files[i].ext, dir.files[j].ext, dir.ignorecase, dir.ignoredia)

// if the extension could not be determined (directories, files without)
// use a zero byte so that these files can be ranked higher
if ext1 == "" {
ext1 = "\x00"
}
if ext2 == "" {
ext2 = "\x00"
}

name1, name2 := normalize(dir.files[i].Name(), dir.files[j].Name(), dir.ignorecase, dir.ignoredia)

// in order to also have natural sorting with the filenames
// combine the name with the ext but have the ext at the front
if !dir.reverse {
return ext1 < ext2 || ext1 == ext2 && name1 < name2
} else {
Expand Down

0 comments on commit d36c8cb

Please sign in to comment.