From dcf30f06d4b26a327e453c01f55d7cdeafd8e0aa Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 19 May 2016 22:47:58 +0800 Subject: [PATCH] Fix F2 'Force Name' issue extension @see https://www.filebot.net/forums/viewtopic.php?f=6&t=3793 --- source/net/filebot/ui/rename/RenamePanel.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/net/filebot/ui/rename/RenamePanel.java b/source/net/filebot/ui/rename/RenamePanel.java index 5c81b587..89e19a5c 100644 --- a/source/net/filebot/ui/rename/RenamePanel.java +++ b/source/net/filebot/ui/rename/RenamePanel.java @@ -7,6 +7,7 @@ import static javax.swing.SwingUtilities.*; import static net.filebot.Logging.*; import static net.filebot.Settings.*; import static net.filebot.util.ExceptionUtilities.*; +import static net.filebot.util.FileUtilities.*; import static net.filebot.util.ui.LoadingOverlayPane.*; import static net.filebot.util.ui.SwingUI.*; @@ -330,11 +331,11 @@ public class RenamePanel extends JComponent { int index = namesList.getListComponent().getSelectedIndex(); if (index >= 0) { File file = (File) filesList.getListComponent().getModel().getElementAt(index); - String generatedName = namesList.getListComponent().getModel().getElementAt(index).toString(); + Object object = namesList.getListComponent().getModel().getElementAt(index); - String forcedName = showInputDialog("Enter Name:", generatedName, "Enter Name", RenamePanel.this); - if (forcedName != null && forcedName.length() > 0) { - renameModel.matches().set(index, new Match(forcedName, file)); + String string = showInputDialog("Enter Name:", object.toString(), "Enter Name", RenamePanel.this); + if (string != null && string.length() > 0) { + renameModel.matches().set(index, new Match(string + '.' + getExtension(file), file)); } } }