From 80e557de2b8d5d18ec184866e2855e13735c2db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 3 Nov 2022 08:43:03 +0100 Subject: [PATCH] Fixed #1782 FLA export - exporting from SWF files inside bundles (like binarysearch) --- CHANGELOG.md | 4 +++- .../jpexs/decompiler/flash/gui/MainPanel.java | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da405e86b..b358592c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] -- [#1860] FLA export - EmptyStackException during exporting MorphShapes +- [#1860] FLA export - EmptyStackException during exporting MorphShape +- [#1782] FLA export - exporting from SWF files inside bundles (like binarysearch) ## [16.0.3] - 2022-11-02 ### Fixed @@ -2455,6 +2456,7 @@ All notable changes to this project will be documented in this file. [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 [#1860]: https://www.free-decompiler.com/flash/issues/1860 +[#1782]: https://www.free-decompiler.com/flash/issues/1782 [#1817]: https://www.free-decompiler.com/flash/issues/1817 [#1816]: https://www.free-decompiler.com/flash/issues/1816 [#1859]: https://www.free-decompiler.com/flash/issues/1859 diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 3a14f009d..63ea30b3c 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -2416,9 +2416,19 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se fc.setCurrentDirectory(new File(selDir)); if (!selDir.endsWith(File.separator)) { selDir += File.separator; + } + String swfShortName = swf.getShortFileName(); + if ("".equals(swfShortName)) { + swfShortName = "untitled.swf"; } - String fileName = new File(swf.getFile()).getName(); - fileName = fileName.substring(0, fileName.length() - 4) + ".fla"; + String fileName; + if (swfShortName.contains(".")) { + fileName = swfShortName.substring(0, swfShortName.lastIndexOf(".")) + ".fla"; + } else { + fileName = swfShortName + ".fla"; + } + final String fSwfShortName = swfShortName; + fc.setSelectedFile(new File(selDir + fileName)); List flaFilters = new ArrayList<>(); List xflFilters = new ArrayList<>(); @@ -2484,9 +2494,9 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se try { AbortRetryIgnoreHandler errorHandler = new GuiAbortRetryIgnoreHandler(); if (compressed) { - swf.exportFla(errorHandler, selfile.getAbsolutePath(), new File(swf.getFile()).getName(), ApplicationInfo.APPLICATION_NAME, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.parallelSpeedUp.get(), selectedVersion); + swf.exportFla(errorHandler, selfile.getAbsolutePath(), fSwfShortName, ApplicationInfo.APPLICATION_NAME, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.parallelSpeedUp.get(), selectedVersion); } else { - swf.exportXfl(errorHandler, selfile.getAbsolutePath(), new File(swf.getFile()).getName(), ApplicationInfo.APPLICATION_NAME, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.parallelSpeedUp.get(), selectedVersion); + swf.exportXfl(errorHandler, selfile.getAbsolutePath(), fSwfShortName, ApplicationInfo.APPLICATION_NAME, ApplicationInfo.applicationVerName, ApplicationInfo.version, Configuration.parallelSpeedUp.get(), selectedVersion); } } catch (Exception ex) { logger.log(Level.SEVERE, "FLA export error", ex);