Fix selectFile function
parent
435b6a29f2
commit
96135cfc40
|
@ -134,9 +134,9 @@ fun app() {
|
||||||
formulairePage(onAnnulerClick = { currentPage.value = "glossaire" })
|
formulairePage(onAnnulerClick = { currentPage.value = "glossaire" })
|
||||||
}
|
}
|
||||||
"choixLangage" -> {
|
"choixLangage" -> {
|
||||||
val jsExtensions = setOf("js", "html")
|
|
||||||
val javaExtensions = setOf("java")
|
|
||||||
val pythonExtensions = setOf("py")
|
val pythonExtensions = setOf("py")
|
||||||
|
val javaExtensions = setOf("java")
|
||||||
|
val jsExtensions = setOf("js", "html")
|
||||||
choixLangagePage(
|
choixLangagePage(
|
||||||
onRetourClick = { currentPage.value = "accueil" },
|
onRetourClick = { currentPage.value = "accueil" },
|
||||||
onPythonClick = {
|
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)
|
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.isVisible = true
|
fileDialog.isVisible = true
|
||||||
|
@ -173,7 +173,7 @@ fun selectFile(allowedExtensions: Set<String>, onFileSelected: (String) -> Unit)
|
||||||
|
|
||||||
// Vérifier si l'extension est autorisée
|
// Vérifier si l'extension est autorisée
|
||||||
val fileExtension = File(filePath).extension.lowercase()
|
val fileExtension = File(filePath).extension.lowercase()
|
||||||
if (allowedExtensions.contains(fileExtension)) {
|
if (extensions.contains(fileExtension)) {
|
||||||
println("Opening: $filePath")
|
println("Opening: $filePath")
|
||||||
onFileSelected(filePath)
|
onFileSelected(filePath)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue