mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Bug 564123: use EnvironmentReader in core build
CBuildConfiguration.findCommand read environments like EnvironmentReader Change-Id: Iedd474c647a0c22fecdd525bf50927159d138031 Signed-off-by: jantje <eclipse@baeyens.it>
This commit is contained in:
parent
9867126d6f
commit
3516a46a92
1 changed files with 9 additions and 5 deletions
|
@ -32,6 +32,7 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -66,6 +67,7 @@ import org.eclipse.cdt.internal.core.model.BinaryRunner;
|
||||||
import org.eclipse.cdt.internal.core.model.CModelManager;
|
import org.eclipse.cdt.internal.core.model.CModelManager;
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserSettings2;
|
import org.eclipse.cdt.internal.core.parser.ParserSettings2;
|
||||||
import org.eclipse.cdt.utils.CommandLineUtil;
|
import org.eclipse.cdt.utils.CommandLineUtil;
|
||||||
|
import org.eclipse.cdt.utils.spawner.EnvironmentReader;
|
||||||
import org.eclipse.core.filesystem.URIUtil;
|
import org.eclipse.core.filesystem.URIUtil;
|
||||||
import org.eclipse.core.resources.IBuildConfiguration;
|
import org.eclipse.core.resources.IBuildConfiguration;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
|
@ -434,16 +436,18 @@ public abstract class CBuildConfiguration extends PlatformObject implements ICBu
|
||||||
if (cmdPath.isAbsolute()) {
|
if (cmdPath.isAbsolute()) {
|
||||||
return cmdPath;
|
return cmdPath;
|
||||||
}
|
}
|
||||||
|
Properties environmentVariables = EnvironmentReader.getEnvVars();
|
||||||
|
Map<String, String> env = new HashMap<>();
|
||||||
|
for (String key : environmentVariables.stringPropertyNames()) {
|
||||||
|
String value = environmentVariables.getProperty(key);
|
||||||
|
env.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, String> env = new HashMap<>(System.getenv());
|
|
||||||
setBuildEnvironment(env);
|
setBuildEnvironment(env);
|
||||||
|
|
||||||
String pathStr = env.get("PATH"); //$NON-NLS-1$
|
String pathStr = env.get("PATH"); //$NON-NLS-1$
|
||||||
if (pathStr == null) {
|
if (pathStr == null) {
|
||||||
pathStr = env.get("Path"); // for Windows //$NON-NLS-1$
|
return null; // no idea
|
||||||
if (pathStr == null) {
|
|
||||||
return null; // no idea
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
String[] path = pathStr.split(File.pathSeparator);
|
String[] path = pathStr.split(File.pathSeparator);
|
||||||
for (String dir : path) {
|
for (String dir : path) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue