From 96135cfc4002159f84979bd47a0ab102f47b06cb Mon Sep 17 00:00:00 2001 From: CAPEL Maxime <83071634+fortyup@users.noreply.github.com> Date: Wed, 6 Dec 2023 13:39:04 +0100 Subject: [PATCH] Fix selectFile function --- src/main/kotlin/main/Main.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/main/Main.kt b/src/main/kotlin/main/Main.kt index 73c653d..75ee2ae 100644 --- a/src/main/kotlin/main/Main.kt +++ b/src/main/kotlin/main/Main.kt @@ -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, onFileSelected: (String) -> Unit) { +fun selectFile(extensions: Set, 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, 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 {