Strict Python Parameters

This commit is contained in:
Konloch 2021-07-19 11:28:47 -07:00
parent c2d2f6627d
commit efd9f84729
8 changed files with 28 additions and 24 deletions

View file

@ -15,9 +15,9 @@ import java.io.File;
public class Configuration
{
public static String python2 = "";
public static String python2Extra = "";
public static boolean python2Extra = false;
public static String python3 = "";
public static String python3Extra = "";
public static boolean python3Extra = false;
public static String rt = "";
public static String library = "";
public static String javac = "";

View file

@ -194,10 +194,12 @@ public class SettingsSerializer
save(BytecodeViewer.viewer.viewPane3.isPaneEditable());
save(Configuration.javaTools);
save(Configuration.python2Extra);
save(Configuration.python3Extra);
save("deprecated");
save("deprecated");
save(Configuration.lastSaveDirectory);
save(Configuration.lastPluginDirectory);
save(Configuration.python2Extra);
save(Configuration.python3Extra);
} catch (Exception e) {
BytecodeViewer.handleException(e);
}
@ -388,10 +390,12 @@ public class SettingsSerializer
BytecodeViewer.viewer.viewPane3.setPaneEditable(asBoolean(133));
Configuration.javaTools = asString(134);
Configuration.python2Extra = asString(135);
Configuration.python3Extra = asString(136);
//ignore 135
//ignore 136
Configuration.lastSaveDirectory = asString(137);
Configuration.lastPluginDirectory = asString(138);
Configuration.python2Extra = asBoolean(139);
Configuration.python3Extra = asBoolean(140);
}
catch (IndexOutOfBoundsException e)
{

View file

@ -70,8 +70,8 @@ public class KrakatauAssembler extends InternalCompiler
try
{
String[] pythonCommands = new String[]{Configuration.python2};
if(!Configuration.python2Extra.isEmpty())
pythonCommands = ArrayUtils.addAll(pythonCommands, Configuration.python2Extra);
if(Configuration.python2Extra)
pythonCommands = ArrayUtils.addAll(pythonCommands, "-2");
ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll(
pythonCommands,

View file

@ -93,8 +93,8 @@ public class KrakatauDecompiler extends InternalDecompiler
try {
String[] pythonCommands = new String[]{Configuration.python2};
if(!Configuration.python2Extra.isEmpty())
pythonCommands = ArrayUtils.addAll(pythonCommands, Configuration.python2Extra);
if(Configuration.python2Extra)
pythonCommands = ArrayUtils.addAll(pythonCommands, "-2");
ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll(
pythonCommands,
@ -177,8 +177,8 @@ public class KrakatauDecompiler extends InternalDecompiler
try {
String[] pythonCommands = new String[]{Configuration.python2};
if(!Configuration.python2Extra.isEmpty())
pythonCommands = ArrayUtils.addAll(pythonCommands, Configuration.python2Extra);
if(Configuration.python2Extra)
pythonCommands = ArrayUtils.addAll(pythonCommands, "-2");
ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll(
pythonCommands,
@ -255,8 +255,8 @@ public class KrakatauDecompiler extends InternalDecompiler
try {
String[] pythonCommands = new String[]{Configuration.python2};
if(!Configuration.python2Extra.isEmpty())
pythonCommands = ArrayUtils.addAll(pythonCommands, Configuration.python2Extra);
if(Configuration.python2Extra)
pythonCommands = ArrayUtils.addAll(pythonCommands, "-2");
ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll(
pythonCommands,

View file

@ -62,8 +62,8 @@ public class KrakatauDisassembler extends InternalDecompiler
try {
String[] pythonCommands = new String[]{Configuration.python2};
if(!Configuration.python2Extra.isEmpty())
pythonCommands = ArrayUtils.addAll(pythonCommands, Configuration.python2Extra);
if(Configuration.python2Extra)
pythonCommands = ArrayUtils.addAll(pythonCommands, "-2");
ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll(
pythonCommands,
@ -127,8 +127,8 @@ public class KrakatauDisassembler extends InternalDecompiler
try {
String[] pythonCommands = new String[]{Configuration.python2};
if(!Configuration.python2Extra.isEmpty())
pythonCommands = ArrayUtils.addAll(pythonCommands, Configuration.python2Extra);
if(Configuration.python2Extra)
pythonCommands = ArrayUtils.addAll(pythonCommands, "-2");
ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll(
pythonCommands,

View file

@ -34,8 +34,8 @@ public class HTMLPane extends JEditorPane
text = text.replace("{java}", Configuration.java);
text = text.replace("{javac}", Configuration.javac);
text = text.replace("{bcvDir}", BCVDir.getAbsolutePath());
text = text.replace("{python}", Configuration.python2+" " + Configuration.python2Extra);
text = text.replace("{python3}", Configuration.python3 + " " + Configuration.python3Extra);
text = text.replace("{python}", Configuration.python2+" " + (Configuration.python2Extra ? "-2" : ""));
text = text.replace("{python3}", Configuration.python3 + " " + (Configuration.python3Extra ? "-3" : ""));
text = text.replace("{rt}", Configuration.rt);
text = text.replace("{lib}", Configuration.library);
text = text.replace("{krakatauVersion}", krakatauVersion);

View file

@ -128,7 +128,7 @@ public class ExternalResources
//check using python CLI flag
testCommand(new String[]{"python", "-2", "--version"}, "python 2", ()->{
Configuration.python2 = "python";
Configuration.python2Extra = "-2";
Configuration.python2Extra = true;
});
if(!Configuration.python2.isEmpty())
return Configuration.python2;
@ -230,7 +230,7 @@ public class ExternalResources
return;
Configuration.python2 = file.getAbsolutePath();
Configuration.python2Extra = "";
Configuration.python2Extra = false;
SettingsSerializer.saveSettingsAsync();
}
@ -244,7 +244,7 @@ public class ExternalResources
return;
Configuration.python3 = file.getAbsolutePath();
Configuration.python3Extra = "";
Configuration.python3Extra = false;
SettingsSerializer.saveSettingsAsync();
}

View file

@ -64,7 +64,7 @@ public class SecurityMan extends SecurityManager
*
* When paired with checkWrite it should prevent most escapes
* JNI is still possible so make sure to block checkLink as well //TODO for BCV
*
*
* Rewritten on 07/19/2021
*
* @author Konloch