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
|
||||
File sitePackagesWindows = new File(python.cachePackage(), "site-packages");
|
||||
File[] packages2 = new File[packages.length + 1];
|
||||
for (int i = 0;i < packages.length; i++){
|
||||
//System.out.println(packages[i].getAbsolutePath());
|
||||
packages2[i] = packages[i];
|
||||
}
|
||||
System.arraycopy(packages, 0, packages2, 0, packages.length);
|
||||
packages2[packages.length] = sitePackagesWindows;
|
||||
//System.out.println(sitePackagesWindows.getAbsolutePath());
|
||||
packages = packages2;
|
||||
|
|
|
@ -30,9 +30,7 @@ public class PythonProcess {
|
|||
private static String pythonExecutable = Loader.load(org.bytedeco.cpython.python.class);
|
||||
public static String runAndReturn(String... arguments)throws IOException, InterruptedException{
|
||||
String[] allArgs = new String[arguments.length + 1];
|
||||
for (int i = 0; i < arguments.length; i++){
|
||||
allArgs[i + 1] = arguments[i];
|
||||
}
|
||||
System.arraycopy(arguments, 0, allArgs, 1, arguments.length);
|
||||
allArgs[0] = pythonExecutable;
|
||||
log.info("Executing command: " + Arrays.toString(allArgs));
|
||||
ProcessBuilder pb = new ProcessBuilder(allArgs);
|
||||
|
@ -45,9 +43,7 @@ public class PythonProcess {
|
|||
|
||||
public static void run(String... arguments)throws IOException, InterruptedException{
|
||||
String[] allArgs = new String[arguments.length + 1];
|
||||
for (int i = 0; i < arguments.length; i++){
|
||||
allArgs[i + 1] = arguments[i];
|
||||
}
|
||||
System.arraycopy(arguments, 0, allArgs, 1, arguments.length);
|
||||
allArgs[0] = pythonExecutable;
|
||||
log.info("Executing command: " + Arrays.toString(allArgs));
|
||||
ProcessBuilder pb = new ProcessBuilder(allArgs);
|
||||
|
|
Loading…
Reference in New Issue