Skip to content

Commit

Permalink
Merge pull request #1653 from pavelbraginskiy/fix-1565
Browse files Browse the repository at this point in the history
Add pdf extension to files selected without one
  • Loading branch information
SJuliez authored Nov 5, 2024
2 parents a16af9c + d85dcd1 commit 0fcf925
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion megameklab/src/megameklab/util/UnitPrintManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import megameklab.printing.*;
import megameklab.ui.dialog.MegaMekLabUnitSelectorDialog;
import megameklab.ui.dialog.PrintQueueDialog;
import org.apache.commons.io.FilenameUtils;

import static megamek.common.options.OptionsConstants.RPG_MANEI_DOMINI;
import static megamek.common.options.OptionsConstants.RPG_PILOT_ADVANTAGES;
Expand Down Expand Up @@ -119,7 +120,14 @@ public static File getExportFile(Frame parent, String suggestedFileName) {
// I want a file, y'know!
return null;
}
return f.getSelectedFile();

var file = f.getSelectedFile();

if (FilenameUtils.getExtension(file.getName()).isEmpty()) {
file = new File(file.getAbsolutePath() + ".pdf");
}

return file;
}

public static List<PrintRecordSheet> createSheets(List<? extends BTObject> entities, boolean singlePrint,
Expand Down

0 comments on commit 0fcf925

Please sign in to comment.