mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 01:45:33 +02:00
Bug 447643 Modified the CommandLauncher to consider Win32 Env variables
Added a check on the parseEnvironment() method to store keys in upper case if the platform is windows Added a method to fetch a property directly from the fEnvironment or using the EnvironmentReader class instead of fetching the map and redirecting the call to that map. This would ensure normalization as the getEnvVar(key) is implemented to use the normalized map. Bug: 447643 Change-Id: Ic664d81781f80663ce18854209077a2f38ec7c3a Signed-off-by: Ghaith Hachem <ghaith.hachem@bachmann.info>
This commit is contained in:
parent
f311c6f050
commit
1d4cf78a0f
1 changed files with 15 additions and 1 deletions
|
@ -106,6 +106,17 @@ public class CommandLauncher implements ICommandLauncher {
|
|||
}
|
||||
return fEnvironment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a property from the given environment.
|
||||
* Asks the Environment reader directly for its key instead of retrieving this entire property map
|
||||
*/
|
||||
private String getEnvironmentProperty(String key) {
|
||||
if (fEnvironment == null) {
|
||||
return EnvironmentReader.getEnvVar(key);
|
||||
}
|
||||
return fEnvironment.getProperty(key);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.ICommandLauncher#getCommandLine()
|
||||
|
@ -138,6 +149,9 @@ public class CommandLauncher implements ICommandLauncher {
|
|||
if (pos < 0)
|
||||
pos = envStr.length();
|
||||
String key = envStr.substring(0, pos);
|
||||
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
||||
key = key.toUpperCase();
|
||||
}
|
||||
String value = envStr.substring(pos + 1);
|
||||
fEnvironment.put(key, value);
|
||||
}
|
||||
|
@ -166,7 +180,7 @@ public class CommandLauncher implements ICommandLauncher {
|
|||
@Override
|
||||
public Process execute(IPath commandPath, String[] args, String[] env, IPath workingDirectory, IProgressMonitor monitor) throws CoreException {
|
||||
parseEnvironment(env);
|
||||
String envPathValue = (String) getEnvironment().get(PATH_ENV);
|
||||
String envPathValue = getEnvironmentProperty(PATH_ENV);
|
||||
|
||||
Boolean isFound = null;
|
||||
String command = commandPath.toOSString();
|
||||
|
|
Loading…
Add table
Reference in a new issue