Skip to content

Commit

Permalink
Make drag and drop extension matching is case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
techncl committed Dec 5, 2024
1 parent 3f3faf4 commit f0b5472
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,19 +262,20 @@ object CsvValidatorUi extends SimpleSwingApplication {
val numOfFilesDropped = files.length
lazy val filePaths = files.map(_.getAbsolutePath)
lazy val (file1Ext, file2Ext) = {
val fileExtensions = filePaths.map(_.split('.').last)
val fileExtensions = filePaths.map(_.split('.').last.toLowerCase)
(fileExtensions.head, fileExtensions.last)
}

if(numOfFilesDropped > 2) showErrorDialog("Drop a maximum of 2 files.")
else if (numOfFilesDropped == 2 && Set(file1Ext, file2Ext) != Set("csv", "csvs"))
showErrorDialog("Drop a single '.csv' file and its corresponding '.csvs' file.")
else filePaths.map { filePath =>
if(filePath.endsWith(".csv")) {
val lowercasedFilePath = filePath.toLowerCase
if(lowercasedFilePath.endsWith(".csv")) {
txtCsvFile.setText(filePath)
true
}
else if(filePath.endsWith(".csvs")) {
else if(lowercasedFilePath.endsWith(".csvs")) {
txtCsvSchemaFile.setText(filePath)
true
}
Expand Down

0 comments on commit f0b5472

Please sign in to comment.