fix(gui): correct handle of selected file in save dialog

This commit is contained in:
Skylot
2022-05-21 21:31:47 +01:00
parent 21e94d8d5c
commit bd8a44c4c9
@@ -51,7 +51,15 @@ public class FileDialog {
return Collections.emptyList();
}
currentDir = fileChooser.getCurrentDirectory().toPath();
return FileUtils.toPaths(fileChooser.getSelectedFiles());
File[] selectedFiles = fileChooser.getSelectedFiles();
if (selectedFiles.length != 0) {
return FileUtils.toPaths(selectedFiles);
}
File chosenFile = fileChooser.getSelectedFile();
if (chosenFile != null) {
return Collections.singletonList(chosenFile.toPath());
}
return Collections.emptyList();
}
public Path getCurrentDir() {