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
|
||||
|
||||
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.Vector;
|
||||
|
||||
|
||||
public class EnvironmentReader {
|
||||
private static Properties envVars = null;
|
||||
private static Vector rawVars = null;
|
||||
|
@ -27,21 +26,21 @@ public class EnvironmentReader {
|
|||
envVars = new Properties();
|
||||
rawVars = new Vector(32);
|
||||
String command = "env";
|
||||
InputStream in = null;
|
||||
InputStream in = null;
|
||||
boolean check_ready = false;
|
||||
boolean isWin32 = false;
|
||||
try {
|
||||
if (OS.indexOf("windows 9") > -1) {
|
||||
command = "command.com /c set";
|
||||
//The buffered stream doesn't always like windows 98
|
||||
check_ready = true;
|
||||
|
||||
} else if ((OS.indexOf("nt") > -1)
|
||||
|| (OS.indexOf("windows 2000") > -1)
|
||||
|| (OS.indexOf("windows xp") > -1)) {
|
||||
isWin32 = true;
|
||||
} else if ((OS.indexOf("nt") > -1) || (OS.indexOf("windows 2000") > -1) || (OS.indexOf("windows xp") > -1)) {
|
||||
command = "cmd.exe /c set";
|
||||
isWin32 = true;
|
||||
}
|
||||
p = ProcessFactory.getFactory().exec(command);
|
||||
in = p .getInputStream();
|
||||
in = p.getInputStream();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
|
@ -49,12 +48,14 @@ public class EnvironmentReader {
|
|||
int idx = line.indexOf('=');
|
||||
if (idx != -1) {
|
||||
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);
|
||||
envVars.setProperty(key, value);
|
||||
} else {
|
||||
envVars.setProperty(line, "");
|
||||
}
|
||||
if(check_ready && br.ready() == false) {
|
||||
if (check_ready && br.ready() == false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -80,9 +81,9 @@ public class EnvironmentReader {
|
|||
Properties p = getEnvVars();
|
||||
return p.getProperty(key);
|
||||
}
|
||||
|
||||
|
||||
public static String[] getRawEnvVars() {
|
||||
getEnvVars();
|
||||
return (String[])rawVars.toArray( new String[0] );
|
||||
return (String[]) rawVars.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue