Restrict to allowed extensions import

main
CAPEL Maxime 2023-12-07 10:49:19 +01:00
parent e47b726467
commit c746f26abd
1 changed files with 2 additions and 17 deletions

View File

@ -93,24 +93,9 @@ fun app() {
glossairePage( glossairePage(
onAjouterMotClick = { currentPage.value = "formulaire" }, onAjouterMotClick = { currentPage.value = "formulaire" },
onImporterClick = { onImporterClick = {
val fileDialog = FileDialog(Frame(), "Select a file", FileDialog.LOAD) selectFile(setOf("csv")) { filePath ->
fileDialog.file = "Untitled.csv" // Initial file name println("Importing file: $filePath")
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")
importCSV(filePath) importCSV(filePath)
} else {
println("Open command cancelled by user.")
} }
}, },
onExporterClick = { onExporterClick = {