So i'm using https://github.com/go-flutter-desktop/go-flutter and use plugin https://github.com/miguelpruivo/flutter_file_picker, but when i pick multi file there is only show 10 files not more. And i check the package file_picker use and then when i see it i found this repo, and i try to use it independent but only show when i choose 10 files.
This is my code
package main
import (
"log"
"strings"
"github.com/gen2brain/dlgs"
"github.com/pkg/errors"
)
func main() {
filter, err := fileFilter("ANY")
if err != nil {
log.Println("Failed to get filter", err)
return
}
filePaths, _, err := dlgs.FileMulti("Select one or more files", filter)
if err != nil {
log.Println("Failed to open dialog picker")
return
}
// type []string is not supported by StandardMessageCodec
sliceFilePaths := make([]interface{}, len(filePaths))
for i, file := range filePaths {
sliceFilePaths[i] = file
}
log.Println(sliceFilePaths)
}
func fileFilter(method string) (string, error) {
switch method {
case "ANY":
return "*", nil
case "IMAGE":
return "Images (*.jpeg,*.png,*.gif)\x00*.jpg;*.jpeg;*.png;*.gif\x00All Files (*.*)\x00*.*\x00\x00", nil
case "AUDIO":
return "Audios (*.mp3)\x00*.mp3\x00All Files (*.*)\x00*.*\x00\x00", nil
case "VIDEO":
return "Videos (*.webm,*.wmv,*.mpeg,*.mkv,*.mp4,*.avi,*.mov,*.flv)\x00*.webm;*.wmv;*.mpeg;*.mkv;*mp4;*.avi;*.mov;*.flv\x00All Files (*.*)\x00*.*\x00\x00", nil
default:
if strings.HasPrefix(method, "__CUSTOM_") {
resolveType := strings.Split(method, "__CUSTOM_")
return "Files (*." + resolveType[1] + ")\x00*." + resolveType[1] + "\x00All Files (*.*)\x00*.*\x00\x00", nil
}
return "", errors.New("unknown method")
}
}
func fileDialog(title string, filter string) (string, error) {
filePath, _, err := dlgs.File(title, filter, false)
if err != nil {
return "", errors.Wrap(err, "failed to open dialog picker")
}
return filePath, nil
}