Skip to content

Ghidra is a software reverse engineering (SRE) framework

Decompiler: Add .xml entension when user did not specify for DebugDecompilerAction

xndcnfaa9907deb25
diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/DebugDecompilerAction.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/DebugDecompilerAction.java
index 70c1aaeb8e..8d70adfaf5 100644
--- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/DebugDecompilerAction.java
+++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/DebugDecompilerAction.java
@@ -29,6 +29,7 @@ import ghidra.app.plugin.core.decompile.DecompilePlugin;
import ghidra.app.util.HelpTopics;
import ghidra.util.HelpLocation;
import ghidra.util.filechooser.ExtensionFileFilter;
+import org.apache.commons.io.FilenameUtils;
public class DebugDecompilerAction extends DockingAction {
@@ -57,6 +58,10 @@ public class DebugDecompilerAction extends DockingAction {
if (file == null) {
return;
}
+ // If user did not specify an extension, add .xml
+ if (FilenameUtils.getExtension(file.getPath()).isEmpty()) {
+ file = new File(file.getAbsolutePath() + ".xml");
+ }
if (file.exists()) {
if (OptionDialog.showYesNoDialog(parentComponent, "Overwrite Existing File?",
"Do you want to overwrite the existing file?") == OptionDialog.OPTION_TWO) {