Merge branch 'GP-0_ryanmkurtz_PR-8251_xndcn_xml'

This commit is contained in:
Ryan Kurtz 2025-06-16 07:50:08 -04:00
commit 66f8d541ea

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -29,6 +29,7 @@ import ghidra.app.plugin.core.decompile.DecompilePlugin;
import ghidra.app.util.HelpTopics; import ghidra.app.util.HelpTopics;
import ghidra.util.HelpLocation; import ghidra.util.HelpLocation;
import ghidra.util.filechooser.ExtensionFileFilter; import ghidra.util.filechooser.ExtensionFileFilter;
import org.apache.commons.io.FilenameUtils;
public class DebugDecompilerAction extends DockingAction { public class DebugDecompilerAction extends DockingAction {
@ -57,6 +58,10 @@ public class DebugDecompilerAction extends DockingAction {
if (file == null) { if (file == null) {
return; 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 (file.exists()) {
if (OptionDialog.showYesNoDialog(parentComponent, "Overwrite Existing File?", if (OptionDialog.showYesNoDialog(parentComponent, "Overwrite Existing File?",
"Do you want to overwrite the existing file?") == OptionDialog.OPTION_TWO) { "Do you want to overwrite the existing file?") == OptionDialog.OPTION_TWO) {