Restrict to allowed extensions

main
CAPEL Maxime 2023-12-06 13:58:12 +01:00
parent 96135cfc40
commit e781783c7b
1 changed files with 1 additions and 0 deletions

View File

@ -163,6 +163,7 @@ fun app() {
fun selectFile(extensions: Set<String>, onFileSelected: (String) -> Unit) { fun selectFile(extensions: Set<String>, onFileSelected: (String) -> Unit) {
val fileDialog = FileDialog(Frame(), "Select a file", FileDialog.LOAD) val fileDialog = FileDialog(Frame(), "Select a file", FileDialog.LOAD)
fileDialog.isMultipleMode = false // To enable selecting only one file fileDialog.isMultipleMode = false // To enable selecting only one file
fileDialog.file = "." + extensions.joinToString(";.")
fileDialog.isVisible = true fileDialog.isVisible = true
val selectedFile = fileDialog.file val selectedFile = fileDialog.file