package main import ( "os" "path/filepath" tea "github.com/charmbracelet/bubbletea" ) type versionInfo struct { name string path string } type versionsFoundMsg []versionInfo type scanErrorMsg struct{ err error } func scanVersions(exeDir string) tea.Cmd { return func() tea.Msg { pattern := filepath.Join(exeDir, ".minecraft", "versions", "*") matches, err := filepath.Glob(pattern) if err != nil { return scanErrorMsg{err: err} } var versions []versionInfo for _, m := range matches { info, err := os.Stat(m) if err != nil || !info.IsDir() { continue } versions = append(versions, versionInfo{ name: filepath.Base(m), path: m, }) } return versionsFoundMsg(versions) } }