Fix selectFile function

main
CAPEL Maxime 2023-12-06 13:39:04 +01:00
parent 435b6a29f2
commit 96135cfc40
1 changed files with 4 additions and 4 deletions

View File

@ -134,9 +134,9 @@ fun app() {
formulairePage(onAnnulerClick = { currentPage.value = "glossaire" })
}
"choixLangage" -> {
val jsExtensions = setOf("js", "html")
val javaExtensions = setOf("java")
val pythonExtensions = setOf("py")
val javaExtensions = setOf("java")
val jsExtensions = setOf("js", "html")
choixLangagePage(
onRetourClick = { currentPage.value = "accueil" },
onPythonClick = {
@ -160,7 +160,7 @@ fun app() {
}
}
fun selectFile(allowedExtensions: Set<String>, onFileSelected: (String) -> Unit) {
fun selectFile(extensions: Set<String>, onFileSelected: (String) -> Unit) {
val fileDialog = FileDialog(Frame(), "Select a file", FileDialog.LOAD)
fileDialog.isMultipleMode = false // To enable selecting only one file
fileDialog.isVisible = true
@ -173,7 +173,7 @@ fun selectFile(allowedExtensions: Set<String>, onFileSelected: (String) -> Unit)
// Vérifier si l'extension est autorisée
val fileExtension = File(filePath).extension.lowercase()
if (allowedExtensions.contains(fileExtension)) {
if (extensions.contains(fileExtension)) {
println("Opening: $filePath")
onFileSelected(filePath)
} else {