You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Fix Android native file picker
This commit is contained in:
@@ -144,14 +144,10 @@ internal class FilePicker {
|
||||
}
|
||||
// ACTION_OPEN_DOCUMENT_TREE does not support intent type
|
||||
if (fileMode != FILE_MODE_OPEN_DIR) {
|
||||
intent.type = "*/*"
|
||||
if (filters.isNotEmpty()) {
|
||||
val resolvedFilters = filters.map { resolveMimeType(it) }.distinct()
|
||||
if (resolvedFilters.size == 1) {
|
||||
intent.type = resolvedFilters[0]
|
||||
} else {
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, resolvedFilters.toTypedArray())
|
||||
}
|
||||
val resolvedFilters = filters.map { resolveMimeType(it) }.distinct()
|
||||
intent.type = resolvedFilters.firstOrNull { it != "application/octet-stream" } ?: "*/*"
|
||||
if (resolvedFilters.size > 1) {
|
||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, resolvedFilters.toTypedArray())
|
||||
}
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user