From 703d31c91d8c2d699ab1a8907ba33ff33939e8a7 Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Thu, 14 Dec 2023 20:50:06 -0600 Subject: [PATCH] fixed being able to select non folder things and also hid .folders aswell --- go.mod | 3 +-- go.sum | 3 --- main.go | 16 +++++++++++++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index e76a10f..3dfbe31 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( fyne.io/fyne/v2 v2.3.5 - github.com/otiai10/copy v1.12.0 + golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f gopkg.in/yaml.v3 v3.0.1 ) @@ -32,7 +32,6 @@ require ( golang.org/x/image v0.3.0 // indirect golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee // indirect golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect - golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect golang.org/x/text v0.6.0 // indirect honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect ) diff --git a/go.sum b/go.sum index d74e595..fe88be5 100644 --- a/go.sum +++ b/go.sum @@ -234,9 +234,6 @@ github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/otiai10/copy v1.12.0 h1:cLMgSQnXBs1eehF0Wy/FAGsgDTDmAqFR7rQylBb1nDY= -github.com/otiai10/copy v1.12.0/go.mod h1:rSaLseMUsZFFbsFGc7wCJnnkTAvdc5L6VWxPE4308Ww= -github.com/otiai10/mint v1.5.1 h1:XaPLeE+9vGbuyEHem1JNk3bYc7KKqyI/na0/mLd/Kks= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/main.go b/main.go index 7d25434..4a5eaa6 100644 --- a/main.go +++ b/main.go @@ -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() {