Set the BLENDER_USER_CONFIG env variable to not use the local blender conf

This commit is contained in:
Laurent Clouet
2015-01-16 17:51:50 +01:00
parent c117bc40e6
commit b61df37034
5 changed files with 26 additions and 5 deletions

View File

@@ -35,6 +35,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
@@ -522,6 +524,10 @@ public class Client {
String[] command = new String[size_command]; String[] command = new String[size_command];
Map<String, String> new_env = new HashMap<String, String>();
new_env.put("BLENDER_USER_CONFIG", this.config.workingDirectory.getAbsolutePath().replace("\\", "\\\\"));
int index = 0; int index = 0;
for (int i = 0; i < command1.length; i++) { for (int i = 0; i < command1.length; i++) {
if (command1[i].equals(".c")) { if (command1[i].equals(".c")) {
@@ -580,7 +586,7 @@ public class Client {
String line; String line;
this.log.debug(Arrays.toString(command)); this.log.debug(Arrays.toString(command));
OS os = OS.getOS(); OS os = OS.getOS();
ajob.setProcess(os.exec(command)); ajob.setProcess(os.exec(command, new_env));
BufferedReader input = new BufferedReader(new InputStreamReader(ajob.getProcess().getInputStream())); BufferedReader input = new BufferedReader(new InputStreamReader(ajob.getProcess().getInputStream()));
long last_update_status = 0; long last_update_status = 0;

View File

@@ -122,7 +122,7 @@ public class Linux extends OS {
} }
@Override @Override
public Process exec(String[] command) throws IOException { public Process exec(String[] command, Map<String, String> env_overight) throws IOException {
// the renderer have a lib directory so add to the LD_LIBRARY_PATH // the renderer have a lib directory so add to the LD_LIBRARY_PATH
// (even if we are not sure that it is the renderer who is launch // (even if we are not sure that it is the renderer who is launch
@@ -155,6 +155,9 @@ public class Linux extends OS {
builder.redirectErrorStream(true); builder.redirectErrorStream(true);
Map<String, String> env = builder.environment(); Map<String, String> env = builder.environment();
env.putAll(new_env); env.putAll(new_env);
if (env_overight != null) {
env.putAll(env_overight);
}
return builder.start(); return builder.start();
} }

View File

@@ -22,6 +22,7 @@ import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.Map;
import com.sheepit.client.Log; import com.sheepit.client.Log;
import com.sheepit.client.Utils; import com.sheepit.client.Utils;
@@ -140,7 +141,7 @@ public class Mac extends OS {
} }
@Override @Override
public Process exec(String[] command) throws IOException { public Process exec(String[] command, Map<String, String> env) throws IOException {
String[] actual_command = command; String[] actual_command = command;
if (this.hasNiceBinary == null) { if (this.hasNiceBinary == null) {
this.checkNiceAvailability(); this.checkNiceAvailability();
@@ -154,6 +155,9 @@ public class Mac extends OS {
} }
ProcessBuilder builder = new ProcessBuilder(actual_command); ProcessBuilder builder = new ProcessBuilder(actual_command);
builder.redirectErrorStream(true); builder.redirectErrorStream(true);
if (env != null) {
builder.environment().putAll(env);
}
return builder.start(); return builder.start();
} }

View File

@@ -19,6 +19,7 @@
package com.sheepit.client.os; package com.sheepit.client.os;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
import com.sheepit.client.hardware.cpu.CPU; import com.sheepit.client.hardware.cpu.CPU;
@@ -37,9 +38,12 @@ public abstract class OS {
return null; return null;
} }
public Process exec(String[] command) throws IOException { public Process exec(String[] command, Map<String, String> env) throws IOException {
ProcessBuilder builder = new ProcessBuilder(command); ProcessBuilder builder = new ProcessBuilder(command);
builder.redirectErrorStream(true); builder.redirectErrorStream(true);
if (env != null) {
builder.environment().putAll(env);
}
return builder.start(); return builder.start();
} }

View File

@@ -19,6 +19,7 @@
package com.sheepit.client.os; package com.sheepit.client.os;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
import com.sheepit.client.hardware.cpu.CPU; import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.os.windows.Kernel32Lib; import com.sheepit.client.os.windows.Kernel32Lib;
@@ -106,7 +107,7 @@ public class Windows extends OS {
} }
@Override @Override
public Process exec(String[] command) throws IOException { public Process exec(String[] command, Map<String, String> env) throws IOException {
// disable a popup because the renderer might crash (seg fault) // disable a popup because the renderer might crash (seg fault)
Kernel32Lib kernel32lib = null; Kernel32Lib kernel32lib = null;
try { try {
@@ -125,6 +126,9 @@ public class Windows extends OS {
ProcessBuilder builder = new ProcessBuilder(command); ProcessBuilder builder = new ProcessBuilder(command);
builder.redirectErrorStream(true); builder.redirectErrorStream(true);
if (env != null) {
builder.environment().putAll(env);
}
Process p = builder.start(); Process p = builder.start();
WinProcess wproc = new WinProcess(p); WinProcess wproc = new WinProcess(p);
wproc.setPriority(WinProcess.PRIORITY_BELOW_NORMAL); wproc.setPriority(WinProcess.PRIORITY_BELOW_NORMAL);