mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
another take on pavarotti
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
0176 (private)
|
||||
X begin the merge of the new A3D, remove old OpenGL code
|
||||
_ Android tools on Windows are broken due to naming changes in r4 SDK
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=1432
|
||||
|
||||
|
||||
_ add method to set the icon (and package name?)
|
||||
|
||||
@@ -143,16 +143,18 @@ public class Device {
|
||||
"-t", target,
|
||||
"-c", "64M"
|
||||
};
|
||||
Process p = Runtime.getRuntime().exec(cmd);
|
||||
StringRedirectThread error = new StringRedirectThread(p.getErrorStream());
|
||||
StringRedirectThread output = new StringRedirectThread(p.getInputStream());
|
||||
Pavarotti p = new Pavarotti(cmd);
|
||||
// Process p = Runtime.getRuntime().exec(cmd);
|
||||
// StringRedirectThread error = new StringRedirectThread(p.getErrorStream());
|
||||
// StringRedirectThread output = new StringRedirectThread(p.getInputStream());
|
||||
|
||||
try {
|
||||
int result = p.waitFor();
|
||||
if (result == 0) {
|
||||
// mumble the result into the console
|
||||
//PApplet.println(output.getLines());
|
||||
for (String s : output.getLines()) {
|
||||
//for (String s : output.getLines()) {
|
||||
for (String s : p.getOutputLines()) {
|
||||
System.out.println(s);
|
||||
}
|
||||
return true;
|
||||
@@ -161,10 +163,11 @@ public class Device {
|
||||
System.out.println("Attempted: '" + PApplet.join(cmd, " ") + "'");
|
||||
// Include the stdout stuff since lots of these tools die with an
|
||||
// error, but use stdout to print their sadness instead of stderr
|
||||
for (String s : output.getLines()) {
|
||||
//for (String s : output.getLines()) {
|
||||
for (String s : p.getOutputLines()) {
|
||||
System.out.println(s);
|
||||
}
|
||||
for (String s : error.getLines()) {
|
||||
for (String s : p.getErrorLines()) {
|
||||
System.err.println(s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
|
||||
package processing.app.tools.android;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import processing.core.PApplet;
|
||||
|
||||
@@ -41,7 +43,18 @@ public class Pavarotti {
|
||||
public Pavarotti(String[] cmd) throws IOException {
|
||||
this.cmd = cmd;
|
||||
|
||||
process = Runtime.getRuntime().exec(cmd);
|
||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
||||
|
||||
// Make sure the ANDROID_SDK variable is set
|
||||
Map<String,String> env = pb.environment();
|
||||
env.put("ANDROID_SDK", Android.sdkPath);
|
||||
// Also make sure that the tools are included in the PATH
|
||||
String path = env.get("PATH");
|
||||
String toolsPath = Android.sdkPath + File.separator + "tools";
|
||||
env.put("PATH", path + File.pathSeparator + toolsPath);
|
||||
|
||||
process = pb.start();
|
||||
//process = Runtime.getRuntime().exec(cmd);
|
||||
error = new StringRedirectThread(process.getErrorStream());
|
||||
output = new StringRedirectThread(process.getInputStream());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user