fix: natsort files in ascending order

This commit is contained in:
2022-04-03 03:58:59 +03:00
parent 6b41f2a89c
commit b18f1e8b31
2 changed files with 89 additions and 0 deletions
+4
View File
@@ -5,6 +5,7 @@ import (
"log"
"os"
"path/filepath"
"sort"
"strings"
"github.com/charmbracelet/bubbles/progress"
@@ -138,6 +139,9 @@ type initUi struct {
func (m *model) statFile() tea.Msg {
if m.IsDirectory {
entries, _ := os.ReadDir(m.Path)
sort.Sort(DirEntrySlice(entries))
for _, entry := range entries {
fullFilePath := filepath.Join(m.Path, entry.Name())