fixed being able to select non folder things and also hid .folders aswell

This commit is contained in:
2023-12-14 20:50:06 -06:00
parent cf65351d4e
commit 703d31c91d
3 changed files with 16 additions and 6 deletions

16
main.go
View File

@@ -5,6 +5,8 @@ import (
"os"
"path/filepath"
"s1d3sw1ped/cpms/admin"
"slices"
"strings"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
@@ -146,7 +148,19 @@ func scanProfiles(profilesroot string) []string {
fmt.Println(err)
}
return m
mm := []string{}
for _, path := range m {
if s, err := os.Stat(path); err == nil && !strings.HasPrefix(s.Name(), ".") && s.IsDir() {
mm = append(mm, path)
}
}
slices.SortStableFunc(mm, func(a, b string) int {
return strings.Compare(a, b)
})
return mm
}
func makeIFunc(profile, archive string, parent fyne.Window) func() {