mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-17 13:48:13 +00:00
Issue #86 open file dialog accepts names with quotes
This commit is contained in:
@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.gui.NewVersionDialog;
|
||||
import com.jpexs.decompiler.flash.gui.View;
|
||||
import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel;
|
||||
import com.jpexs.decompiler.flash.gui.proxy.ProxyFrame;
|
||||
import com.jpexs.decompiler.flash.helpers.Helper;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
@@ -277,7 +278,7 @@ public class Main {
|
||||
View.setWindowIcon(f);
|
||||
int returnVal = fc.showSaveDialog(f);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
File file = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
try {
|
||||
Main.saveFile(file.getAbsolutePath());
|
||||
Configuration.setConfig("lastSaveDir", file.getParentFile().getAbsolutePath());
|
||||
@@ -309,8 +310,8 @@ public class Main {
|
||||
View.setWindowIcon(f);
|
||||
int returnVal = fc.showOpenDialog(f);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
Configuration.setConfig("lastOpenDir", fc.getSelectedFile().getParentFile().getAbsolutePath());
|
||||
File selfile = fc.getSelectedFile();
|
||||
Configuration.setConfig("lastOpenDir", Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
|
||||
File selfile = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
Main.openFile(selfile.getAbsolutePath());
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -103,10 +103,10 @@ public class ClassesListTree extends JTree implements TreeSelectionListener {
|
||||
ABC abc = tag.getABC();
|
||||
for (int i = 0; i < abc.script_info.length; i++) {
|
||||
ScriptInfo script = abc.script_info[i];
|
||||
HashMap<String, ScriptPack> packs=script.getPacks(abc, i);
|
||||
for(String path:packs.keySet()){
|
||||
HashMap<String, ScriptPack> packs = script.getPacks(abc, i);
|
||||
for (String path : packs.keySet()) {
|
||||
ret.put(path, packs.get(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -1154,8 +1154,8 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
View.setWindowIcon(f);
|
||||
int returnVal = fc.showOpenDialog(f);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
Configuration.setConfig("lastOpenDir", fc.getSelectedFile().getParentFile().getAbsolutePath());
|
||||
File selfile = fc.getSelectedFile();
|
||||
Configuration.setConfig("lastOpenDir", Helper.fixDialogFile(fc.getSelectedFile()).getParentFile().getAbsolutePath());
|
||||
File selfile = Helper.fixDialogFile(fc.getSelectedFile());
|
||||
byte data[] = Helper.readFile(selfile.getAbsolutePath());
|
||||
try {
|
||||
it.setImage(data);
|
||||
@@ -1289,8 +1289,8 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
|
||||
final long timeBefore = System.currentTimeMillis();
|
||||
Main.startWork("Exporting...");
|
||||
final String selFile = chooser.getSelectedFile().getAbsolutePath();
|
||||
Configuration.setConfig("lastExportDir", chooser.getSelectedFile().getParentFile().getAbsolutePath());
|
||||
final String selFile = Helper.fixDialogFile(chooser.getSelectedFile()).getAbsolutePath();
|
||||
Configuration.setConfig("lastExportDir", Helper.fixDialogFile(chooser.getSelectedFile()).getParentFile().getAbsolutePath());
|
||||
final boolean isPcode = export.getOption(ExportDialog.OPTION_ACTIONSCRIPT) == 1;
|
||||
final boolean isMp3 = export.getOption(ExportDialog.OPTION_SOUNDS) == 0;
|
||||
final boolean isFormatted = export.getOption(ExportDialog.OPTION_TEXTS) == 1;
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.helpers;
|
||||
import com.jpexs.decompiler.flash.graph.GraphTargetItem;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -29,6 +30,8 @@ import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Class with helper method
|
||||
@@ -346,4 +349,14 @@ public class Helper {
|
||||
ret += "]";
|
||||
return Highlighting.stripHilights(ret);
|
||||
}
|
||||
|
||||
public static File fixDialogFile(File f) {
|
||||
Pattern pat = Pattern.compile("\"([^\"]+)\"");
|
||||
String name = f.getAbsolutePath();
|
||||
Matcher m = pat.matcher(name);
|
||||
if (m.find()) {
|
||||
f = new File(m.group(1));
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user