mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-21 13:15:34 +00:00
Issue #212 Cannot create directory issue / parallel mkdirs
This commit is contained in:
@@ -989,9 +989,12 @@ public class SWF {
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
File foutdir = new File(outdir);
|
||||
if (!foutdir.exists()) {
|
||||
if (!foutdir.mkdirs()) {
|
||||
if (!foutdir.exists()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
@@ -1176,9 +1179,12 @@ public class SWF {
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
File foutdir = new File(outdir);
|
||||
if (!foutdir.exists()) {
|
||||
if (!foutdir.mkdirs()) {
|
||||
if (!foutdir.exists()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
@@ -1198,9 +1204,12 @@ public class SWF {
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
File foutdir = new File(outdir);
|
||||
if (!foutdir.exists()) {
|
||||
if (!foutdir.mkdirs()) {
|
||||
if (!foutdir.exists()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
@@ -1228,9 +1237,12 @@ public class SWF {
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
File foutdir = new File(outdir);
|
||||
if (!foutdir.exists()) {
|
||||
if (!foutdir.mkdirs()) {
|
||||
if (!foutdir.exists()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
@@ -1254,9 +1266,12 @@ public class SWF {
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
File foutdir = new File(outdir);
|
||||
if (!foutdir.exists()) {
|
||||
if (!foutdir.mkdirs()) {
|
||||
if (!foutdir.exists()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
@@ -1277,9 +1292,12 @@ public class SWF {
|
||||
if (tags.isEmpty()) {
|
||||
return ret;
|
||||
}
|
||||
if (!(new File(outdir)).exists()) {
|
||||
if (!(new File(outdir)).mkdirs()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
File foutdir = new File(outdir);
|
||||
if (!foutdir.exists()) {
|
||||
if (!foutdir.mkdirs()) {
|
||||
if (!foutdir.exists()) {
|
||||
throw new IOException("Cannot create directory " + outdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Tag t : tags) {
|
||||
@@ -1975,11 +1993,11 @@ public class SWF {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void exportFla(String outfile, String swfName, String generator, String generatorVerName, String generatorVersion, boolean paralel) {
|
||||
public void exportFla(String outfile, String swfName, String generator, String generatorVerName, String generatorVersion, boolean paralel) throws IOException {
|
||||
XFLConverter.convertSWF(this, swfName, outfile, true, generator, generatorVerName, generatorVersion, paralel);
|
||||
}
|
||||
|
||||
public void exportXfl(String outfile, String swfName, String generator, String generatorVerName, String generatorVersion, boolean paralel) {
|
||||
public void exportXfl(String outfile, String swfName, String generator, String generatorVerName, String generatorVersion, boolean paralel) throws IOException {
|
||||
XFLConverter.convertSWF(this, swfName, outfile, false, generator, generatorVerName, generatorVersion, paralel);
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,9 @@ public class TagNode {
|
||||
if ((node.tag instanceof ASMSource) && (node.export)) {
|
||||
if (!dir.exists()) {
|
||||
if (!dir.mkdirs()) {
|
||||
continue;
|
||||
if (!dir.exists()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -102,7 +102,9 @@ public class ScriptPack {
|
||||
File outDir = new File(directory + File.separatorChar + makeDirPath(packageName));
|
||||
if (!outDir.exists()) {
|
||||
if (!outDir.mkdirs()) {
|
||||
throw new IOException("cannot create directory " + outDir);
|
||||
if (!outDir.exists()) {
|
||||
throw new IOException("cannot create directory " + outDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
String fileName = outDir.toString() + File.separator + Helper.makeFileName(scriptName) + ".as";
|
||||
|
||||
@@ -159,7 +159,11 @@ public abstract class Trait implements Serializable {
|
||||
String objectName = name.getName(abc.constants, new ArrayList<String>());
|
||||
File outDir = new File(directory + File.separatorChar + packageName.replace('.', File.separatorChar));
|
||||
if (!outDir.exists()) {
|
||||
outDir.mkdirs();
|
||||
if (!outDir.mkdirs()) {
|
||||
if (!outDir.exists()) {
|
||||
throw new IOException("Cannot create directory " + outDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
String fileName = outDir.toString() + File.separator + objectName + ".as";
|
||||
try (FileOutputStream fos = new FileOutputStream(fileName)) {
|
||||
|
||||
@@ -680,10 +680,14 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
public static String tempFile(String url) {
|
||||
public static String tempFile(String url) throws IOException {
|
||||
File f = new File(getFFDecHome() + "saved" + File.separator);
|
||||
if (!f.exists()) {
|
||||
f.mkdirs();
|
||||
if (!f.mkdirs()) {
|
||||
if (!f.exists()) {
|
||||
throw new IOException("cannot create directory " + f);
|
||||
}
|
||||
}
|
||||
}
|
||||
return getFFDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp";
|
||||
|
||||
@@ -774,7 +778,11 @@ public class Main {
|
||||
}
|
||||
|
||||
public static void exit() {
|
||||
Configuration.saveToFile(getConfigFile(), getReplacementsFile());
|
||||
try {
|
||||
Configuration.saveToFile(getConfigFile(), getReplacementsFile());
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
FlashPlayerPanel.unload();
|
||||
System.exit(0);
|
||||
}
|
||||
@@ -933,7 +941,7 @@ public class Main {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static String getFFDecHome() {
|
||||
public static String getFFDecHome() throws IOException {
|
||||
if (directory == unspecifiedFile) {
|
||||
directory = null;
|
||||
String userHome = null;
|
||||
@@ -975,7 +983,11 @@ public class Main {
|
||||
}
|
||||
}
|
||||
if (!directory.exists()) {
|
||||
directory.mkdirs();
|
||||
if (!directory.mkdirs()) {
|
||||
if (!directory.exists()) {
|
||||
throw new IOException("cannot create directory " + directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
String ret = directory.getAbsolutePath();
|
||||
if (!ret.endsWith(File.separator)) {
|
||||
@@ -984,11 +996,11 @@ public class Main {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static String getReplacementsFile() {
|
||||
private static String getReplacementsFile() throws IOException {
|
||||
return getFFDecHome() + REPLACEMENTS_NAME;
|
||||
}
|
||||
|
||||
private static String getConfigFile() {
|
||||
private static String getConfigFile() throws IOException {
|
||||
return getFFDecHome() + CONFIG_NAME;
|
||||
}
|
||||
|
||||
|
||||
@@ -611,7 +611,14 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection
|
||||
}
|
||||
Random rnd = new Random();
|
||||
tempDir += "ffdec" + File.separator + "export" + File.separator + System.currentTimeMillis() + "_" + rnd.nextInt(1000);
|
||||
new File(tempDir).mkdirs();
|
||||
File fTempDir = new File(tempDir);
|
||||
if (!fTempDir.exists()) {
|
||||
if (!fTempDir.mkdirs()) {
|
||||
if (!fTempDir.exists()) {
|
||||
throw new IOException("cannot create directory " + fTempDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
final ExportDialog export = new ExportDialog();
|
||||
|
||||
try {
|
||||
@@ -1940,10 +1947,14 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection
|
||||
(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (compressed) {
|
||||
swf.exportFla(selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, (Boolean) Configuration.getConfig("paralelSpeedUp", Boolean.TRUE));
|
||||
} else {
|
||||
swf.exportXfl(selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, (Boolean) Configuration.getConfig("paralelSpeedUp", Boolean.TRUE));
|
||||
try {
|
||||
if (compressed) {
|
||||
swf.exportFla(selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, (Boolean) Configuration.getConfig("paralelSpeedUp", Boolean.TRUE));
|
||||
} else {
|
||||
swf.exportXfl(selfile.getAbsolutePath(), new File(Main.file).getName(), Main.applicationName, Main.applicationVerName, Main.version, (Boolean) Configuration.getConfig("paralelSpeedUp", Boolean.TRUE));
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
JOptionPane.showMessageDialog(null, translate("error.export") + ": " + ex.getLocalizedMessage(), translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
Main.stopWork();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
@@ -190,10 +192,16 @@ public class ProxyFrame extends AppFrame implements ActionListener, CatchedListe
|
||||
if (e.getActionCommand().equals("CLEAR")) {
|
||||
for (int i = 0; i < listModel.getSize(); i++) {
|
||||
Replacement r = (Replacement) listModel.getElementAt(i);
|
||||
File f = (new File(Main.tempFile(r.targetFile)));
|
||||
if (f.exists()) {
|
||||
f.delete();
|
||||
File f;
|
||||
try {
|
||||
f = (new File(Main.tempFile(r.targetFile)));
|
||||
if (f.exists()) {
|
||||
f.delete();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(ProxyFrame.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
listModel.clear();
|
||||
}
|
||||
|
||||
@@ -2450,7 +2450,7 @@ public class XFLConverter {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static void convertSWF(SWF swf, String swfFileName, String outfile, boolean compressed, String generator, String generatorVerName, String generatorVersion, boolean paralel) {
|
||||
public static void convertSWF(SWF swf, String swfFileName, String outfile, boolean compressed, String generator, String generatorVerName, String generatorVersion, boolean paralel) throws IOException {
|
||||
File file = new File(outfile);
|
||||
File outDir = file.getParentFile();
|
||||
String domDocument = "";
|
||||
@@ -2530,7 +2530,11 @@ public class XFLConverter {
|
||||
expPath = expPath.replace(".", File.separator);
|
||||
File cdir = new File(outDir.getAbsolutePath() + File.separator + expDir);
|
||||
if (!cdir.exists()) {
|
||||
cdir.mkdirs();
|
||||
if (!cdir.mkdirs()) {
|
||||
if (!cdir.exists()) {
|
||||
throw new IOException("cannot create directory " + cdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
writeFile(data.getBytes("UTF-8"), outDir.getAbsolutePath() + File.separator + expPath + ".as");
|
||||
@@ -2770,7 +2774,13 @@ public class XFLConverter {
|
||||
|
||||
} else {
|
||||
|
||||
outDir.mkdirs();
|
||||
if (!outDir.exists()) {
|
||||
if (!outDir.mkdirs()) {
|
||||
if (!outDir.exists()) {
|
||||
throw new IOException("cannot create directory " + outDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
writeFile(domDocument.getBytes("UTF-8"), outDir.getAbsolutePath() + File.separator + "DOMDocument.xml");
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
|
||||
Reference in New Issue
Block a user