From c746f26abdf0858cf573e763ca5eb1253fd25dee Mon Sep 17 00:00:00 2001 From: CAPEL Maxime <83071634+fortyup@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:49:19 +0100 Subject: [PATCH] Restrict to allowed extensions import --- src/main/kotlin/main/Main.kt | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/src/main/kotlin/main/Main.kt b/src/main/kotlin/main/Main.kt index 8268642..e28bbab 100644 --- a/src/main/kotlin/main/Main.kt +++ b/src/main/kotlin/main/Main.kt @@ -93,24 +93,9 @@ fun app() { glossairePage( onAjouterMotClick = { currentPage.value = "formulaire" }, onImporterClick = { - val fileDialog = FileDialog(Frame(), "Select a file", FileDialog.LOAD) - fileDialog.file = "Untitled.csv" // Initial file name - fileDialog.isMultipleMode = false // To enable selecting only one file - - fileDialog.setFile("*.csv") - fileDialog.isVisible = true - - val selectedFile = fileDialog.file - val selectedDirectory = fileDialog.directory - - if (selectedFile != null) { - val filePath = selectedDirectory + selectedFile - println("Opening: $filePath") - + selectFile(setOf("csv")) { filePath -> + println("Importing file: $filePath") importCSV(filePath) - - } else { - println("Open command cancelled by user.") } }, onExporterClick = {