Fixed #2074, #2074 Use mxmlc.bat file when exe not available for Flex SDK compilation

This commit is contained in:
Jindra Petřík
2023-11-05 21:11:10 +01:00
parent 48a19756e9
commit 0d1e2f1422
4 changed files with 23 additions and 3 deletions
@@ -248,7 +248,7 @@ public class SwfToSwcExporter {
printDelay("swc.documentTag", t2, t3);
if (!documentClassSet) {
throw new IOException("Original document class not found!");
//throw new IOException("Original document class not found!");
}
swf = recompileSWF(swf);
t4 = System.currentTimeMillis();
@@ -235,6 +235,7 @@ public class MxmlcAs3ScriptReplacer extends MxmlcRunner implements As3ScriptRepl
pack.abc.reorganizeClasses(classesRemap);
}
((Tag) pack.abc.parentTag).setModified(true);
pack.abc.getSwf().getAbcIndex().refreshAbc(pack.abc);
deinitReplacement(pack); //successfull finish
}
@@ -243,7 +244,7 @@ public class MxmlcAs3ScriptReplacer extends MxmlcRunner implements As3ScriptRepl
@Override
public boolean isAvailable() {
String flexLocation = Configuration.flexSdkLocation.get();
return !(flexLocation.isEmpty() || (!new File(MxmlcRunner.getMxmlcPath(flexLocation)).exists()));
return !(flexLocation.isEmpty() || MxmlcRunner.getMxmlcPath(flexLocation) == null);
}
@Override
@@ -31,7 +31,24 @@ public class MxmlcRunner {
public static String getMxmlcPath(String flexSdkPath) {
boolean isWin = System.getProperty("os.name").toLowerCase().contains("win");
return flexSdkPath + File.separator + "bin" + File.separator + "mxmlc" + (isWin ? ".exe" : "");
String path = flexSdkPath + File.separator + "bin" + File.separator + "mxmlc";
String exePath = path + ".exe";
String batPath = path + ".bat";
if (isWin) {
if (new File(exePath).exists()) {
return exePath;
}
if (new File(batPath).exists()) {
return batPath;
}
} else {
if (new File(path).exists()) {
return exePath;
}
}
return null;
}
public void mxmlc(String... arguments) throws MxmlcException, InterruptedException, IOException {