Sort 'ls' page by recent

This commit is contained in:
Daniel Heath 2018-01-18 17:12:03 +11:00
parent a36f8e318e
commit ff2920965d
1 changed files with 2 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import (
"os"
"path"
"regexp"
"sort"
"strings"
"time"
@ -65,6 +66,7 @@ func DirectoryList() []DirectoryEntry {
LastEdited: time.Unix(p.Text.LastEditTime()/1000000000, 0),
}
}
sort.Slice(entries, func(i, j int) bool { return entries[i].LastEdited.Before(entries[j].LastEdited) })
return entries
}