MohamedRejeb / Calf

Calf is a library that allows you to easily create adaptive UIs and access platform specific APIs with Compose Multiplatform (Adaptive UI, File Picker, WebView, Permissions...).
https://mohamedrejeb.github.io/Calf/
Apache License 2.0
907 stars 41 forks source link

Allow the file picker to show only custom file extension #74

Closed sschuberth closed 3 months ago

sschuberth commented 7 months ago

It seems like currently there's no way to only display files matching custom extensions in the picker. In my case, I'd like only *.json and *.yml files to show up for picking. Is this a functionality that could be added?

MohamedRejeb commented 7 months ago

For now only custom mime types are supported, but I will add custom extensions in the future. You can use:

FilePickerFileType.Custom(
    listOf(
        "application/json",
        "application/x-yaml",
    ),
),
sschuberth commented 7 months ago
"application/x-yaml"

Thanks, but I guess this will also allow to select *.yaml whereas I really only want *.yml, correct?

MohamedRejeb commented 7 months ago

Yes, you can search for a specific mime type for that extension. I will try to add extensions support ASAP.