Using embedded copying of an array instead of manual (#9073)
Signed-off-by: Dariusz Zbyrad <dariusz.zbyrad@gmail.com>master
parent
4394965cb5
commit
8ff0aa8ddf
|
@ -345,10 +345,7 @@ public class PythonExecutioner {
|
||||||
//// TODO: fix in javacpp
|
//// TODO: fix in javacpp
|
||||||
File sitePackagesWindows = new File(python.cachePackage(), "site-packages");
|
File sitePackagesWindows = new File(python.cachePackage(), "site-packages");
|
||||||
File[] packages2 = new File[packages.length + 1];
|
File[] packages2 = new File[packages.length + 1];
|
||||||
for (int i = 0;i < packages.length; i++){
|
System.arraycopy(packages, 0, packages2, 0, packages.length);
|
||||||
//System.out.println(packages[i].getAbsolutePath());
|
|
||||||
packages2[i] = packages[i];
|
|
||||||
}
|
|
||||||
packages2[packages.length] = sitePackagesWindows;
|
packages2[packages.length] = sitePackagesWindows;
|
||||||
//System.out.println(sitePackagesWindows.getAbsolutePath());
|
//System.out.println(sitePackagesWindows.getAbsolutePath());
|
||||||
packages = packages2;
|
packages = packages2;
|
||||||
|
|
|
@ -30,9 +30,7 @@ public class PythonProcess {
|
||||||
private static String pythonExecutable = Loader.load(org.bytedeco.cpython.python.class);
|
private static String pythonExecutable = Loader.load(org.bytedeco.cpython.python.class);
|
||||||
public static String runAndReturn(String... arguments)throws IOException, InterruptedException{
|
public static String runAndReturn(String... arguments)throws IOException, InterruptedException{
|
||||||
String[] allArgs = new String[arguments.length + 1];
|
String[] allArgs = new String[arguments.length + 1];
|
||||||
for (int i = 0; i < arguments.length; i++){
|
System.arraycopy(arguments, 0, allArgs, 1, arguments.length);
|
||||||
allArgs[i + 1] = arguments[i];
|
|
||||||
}
|
|
||||||
allArgs[0] = pythonExecutable;
|
allArgs[0] = pythonExecutable;
|
||||||
log.info("Executing command: " + Arrays.toString(allArgs));
|
log.info("Executing command: " + Arrays.toString(allArgs));
|
||||||
ProcessBuilder pb = new ProcessBuilder(allArgs);
|
ProcessBuilder pb = new ProcessBuilder(allArgs);
|
||||||
|
@ -45,9 +43,7 @@ public class PythonProcess {
|
||||||
|
|
||||||
public static void run(String... arguments)throws IOException, InterruptedException{
|
public static void run(String... arguments)throws IOException, InterruptedException{
|
||||||
String[] allArgs = new String[arguments.length + 1];
|
String[] allArgs = new String[arguments.length + 1];
|
||||||
for (int i = 0; i < arguments.length; i++){
|
System.arraycopy(arguments, 0, allArgs, 1, arguments.length);
|
||||||
allArgs[i + 1] = arguments[i];
|
|
||||||
}
|
|
||||||
allArgs[0] = pythonExecutable;
|
allArgs[0] = pythonExecutable;
|
||||||
log.info("Executing command: " + Arrays.toString(allArgs));
|
log.info("Executing command: " + Arrays.toString(allArgs));
|
||||||
ProcessBuilder pb = new ProcessBuilder(allArgs);
|
ProcessBuilder pb = new ProcessBuilder(allArgs);
|
||||||
|
|
Loading…
Reference in New Issue