mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed #46431
This commit is contained in:
parent
104831688d
commit
71ace4a897
2 changed files with 15 additions and 10 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2003-11-13 David Inglis
|
||||||
|
Fixed #46431
|
||||||
|
* utils/org/eclipse/cdt/utils/spawner/EnvironmentReader.java
|
||||||
|
|
||||||
2003-11-06 David Inglis
|
2003-11-06 David Inglis
|
||||||
|
|
||||||
Fix for 45835 also changed binary runner control to stop running when project closes/open/deleted
|
Fix for 45835 also changed binary runner control to stop running when project closes/open/deleted
|
||||||
|
|
|
@ -12,7 +12,6 @@ import java.io.InputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
|
||||||
public class EnvironmentReader {
|
public class EnvironmentReader {
|
||||||
private static Properties envVars = null;
|
private static Properties envVars = null;
|
||||||
private static Vector rawVars = null;
|
private static Vector rawVars = null;
|
||||||
|
@ -29,19 +28,19 @@ public class EnvironmentReader {
|
||||||
String command = "env";
|
String command = "env";
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
boolean check_ready = false;
|
boolean check_ready = false;
|
||||||
|
boolean isWin32 = false;
|
||||||
try {
|
try {
|
||||||
if (OS.indexOf("windows 9") > -1) {
|
if (OS.indexOf("windows 9") > -1) {
|
||||||
command = "command.com /c set";
|
command = "command.com /c set";
|
||||||
//The buffered stream doesn't always like windows 98
|
//The buffered stream doesn't always like windows 98
|
||||||
check_ready = true;
|
check_ready = true;
|
||||||
|
isWin32 = true;
|
||||||
} else if ((OS.indexOf("nt") > -1)
|
} else if ((OS.indexOf("nt") > -1) || (OS.indexOf("windows 2000") > -1) || (OS.indexOf("windows xp") > -1)) {
|
||||||
|| (OS.indexOf("windows 2000") > -1)
|
|
||||||
|| (OS.indexOf("windows xp") > -1)) {
|
|
||||||
command = "cmd.exe /c set";
|
command = "cmd.exe /c set";
|
||||||
|
isWin32 = true;
|
||||||
}
|
}
|
||||||
p = ProcessFactory.getFactory().exec(command);
|
p = ProcessFactory.getFactory().exec(command);
|
||||||
in = p .getInputStream();
|
in = p.getInputStream();
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||||
String line;
|
String line;
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
|
@ -49,12 +48,14 @@ public class EnvironmentReader {
|
||||||
int idx = line.indexOf('=');
|
int idx = line.indexOf('=');
|
||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
String key = line.substring(0, idx);
|
String key = line.substring(0, idx);
|
||||||
|
if (isWin32) //Since windows env ignores case let normalize to Upper here.
|
||||||
|
key = key.toUpperCase();
|
||||||
String value = line.substring(idx + 1);
|
String value = line.substring(idx + 1);
|
||||||
envVars.setProperty(key, value);
|
envVars.setProperty(key, value);
|
||||||
} else {
|
} else {
|
||||||
envVars.setProperty(line, "");
|
envVars.setProperty(line, "");
|
||||||
}
|
}
|
||||||
if(check_ready && br.ready() == false) {
|
if (check_ready && br.ready() == false) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +84,6 @@ public class EnvironmentReader {
|
||||||
|
|
||||||
public static String[] getRawEnvVars() {
|
public static String[] getRawEnvVars() {
|
||||||
getEnvVars();
|
getEnvVars();
|
||||||
return (String[])rawVars.toArray( new String[0] );
|
return (String[]) rawVars.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue