Skip to content

Commit e426b7d

Browse files
committed
Use '.getFileName' to get folder name rather than '.split('/').last'
Previous iteration didn't work for Windows, as it uses '\' for file paths
1 parent 9ed4816 commit e426b7d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

csv-validator-ui/src/main/scala/uk/gov/nationalarchives/csv/validator/ui/CsvValidatorUi.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,8 @@ object CsvValidatorUi extends SimpleSwingApplication {
514514
fileButton.reactions += {
515515
case ev: ButtonClicked =>
516516
val startingDir = if(fileTextField.text.isEmpty) userDir.toFile else Path.of(fileTextField.text).toFile
517-
val helpText = s"Select the ${fromPathText.text.split("/").last} folder"
517+
val fromFolderName = Path.of(fromPathText.text).getFileName
518+
val helpText = s"Select the ${fromFolderName} folder"
518519
val fileChooser = new FileChooser(startingDir)
519520
fileChooser.title = helpText
520521
fileChooser.fileSelectionMode = SelectionMode.DirectoriesOnly

0 commit comments

Comments
 (0)