Skip to content

Commit

Permalink
Small file transfer fixes [stage]
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Oct 10, 2024
1 parent 2191ccb commit 2680066
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ public static FileConflictChoice showFileConflictAlert(String file, boolean mult
new ButtonType(AppI18n.get("renameAll"), ButtonBar.ButtonData.OTHER),
FileConflictChoice.RENAME_ALL);
}
var w = multiple ? 700 : 400;
return AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("fileConflictAlertTitle"));
alert.setHeaderText(AppI18n.get("fileConflictAlertHeader"));
alert.setAlertType(Alert.AlertType.CONFIRMATION);
alert.getButtonTypes().clear();
alert.getDialogPane().setContent(AppWindowHelper.alertContentText(AppI18n.get(
multiple ? "fileConflictAlertContentMultiple" : "fileConflictAlertContent", file), 655));
alert.getDialogPane().setMinWidth(705);
alert.getDialogPane().setPrefWidth(705);
alert.getDialogPane().setMaxWidth(705);
multiple ? "fileConflictAlertContentMultiple" : "fileConflictAlertContent", file), w - 50));
alert.getDialogPane().setMinWidth(w);
alert.getDialogPane().setPrefWidth(w);
alert.getDialogPane().setMaxWidth(w);
map.sequencedKeySet()
.forEach(buttonType -> alert.getButtonTypes().add(buttonType));
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private String renameFileLoop(FileSystem fileSystem, String target, boolean dir)
private String renameFile(String target) {
var targetFile = new FilePath(target);
var name = targetFile.getFileName();
var pattern = Pattern.compile("(.+?) \\((\\d+)\\)\\.(.+)");
var pattern = Pattern.compile("(.+) \\((\\d+)\\)\\.(.+?)");
var matcher = pattern.matcher(name);
if (matcher.matches()) {
try {
Expand All @@ -209,7 +209,8 @@ private String renameFile(String target) {
} catch (NumberFormatException e) {}
}

return targetFile.getBaseName() + " (" + 1 + ")." + targetFile.getExtension();
var noExt = targetFile.getFileName().equals(targetFile.getExtension());
return targetFile.getBaseName() + " (" + 1 + ")" + (noExt ? "" : "." + targetFile.getExtension());
}

private void handleSingleAcrossFileSystems(FileEntry source) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.2-3
12.2-4

0 comments on commit 2680066

Please sign in to comment.