mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-15 16:52:02 +00:00
#709 Text Export to Single File with custom filename: fixed
This commit is contained in:
@@ -135,6 +135,9 @@ public class Configuration {
|
||||
@ConfigurationCategory("export")
|
||||
public static final ConfigurationItem<Boolean> openFolderAfterFlaExport = null;
|
||||
|
||||
@ConfigurationCategory("export")
|
||||
public static final ConfigurationItem<String> overrideTextExportFileName = null;
|
||||
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
@ConfigurationCategory("debug")
|
||||
public static final ConfigurationItem<Boolean> useDetailedLogging = null;
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.TextTag;
|
||||
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.Path;
|
||||
import com.jpexs.helpers.utf8.Utf8Helper;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -84,8 +85,14 @@ public class TextExporter {
|
||||
}
|
||||
|
||||
if (settings.singleFile) {
|
||||
final File file = new File(outdir + File.separator
|
||||
+ (settings.mode == TextExportMode.FORMATTED ? TEXT_EXPORT_FILENAME_FORMATTED : TEXT_EXPORT_FILENAME_PLAIN));
|
||||
String fileName = Configuration.overrideTextExportFileName.get();
|
||||
if (fileName != null) {
|
||||
String swfName = Path.getFileNameWithoutExtension(new File(tags.get(0).getSwf().getShortFileName()));
|
||||
fileName = fileName.replace("{fileName}", swfName);
|
||||
} else {
|
||||
fileName = settings.mode == TextExportMode.FORMATTED ? TEXT_EXPORT_FILENAME_FORMATTED : TEXT_EXPORT_FILENAME_PLAIN;
|
||||
}
|
||||
final File file = new File(outdir + File.separator + fileName);
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
for (final Tag t : tags) {
|
||||
if (t instanceof TextTag) {
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.helpers;
|
||||
|
||||
import java.io.File;
|
||||
@@ -65,7 +66,7 @@ public class Path {
|
||||
int i = s.lastIndexOf('.');
|
||||
|
||||
if (i > 0 && i < s.length() - 1) {
|
||||
if (i > 0 && i < s.length() - 1) {
|
||||
ext = s.substring(0, i);
|
||||
}
|
||||
return ext;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user