Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2017-05-31 12:18:18 -0400
committerDoug Schaefer2017-05-31 13:07:37 -0400
commitd3dcd92d8f41e7ead0fc1e0388ffc4cf74f1906b (patch)
treebd73b67fa599d3b6f115746ee06901381412827b
parent63ff83042b671f6cf09fe259302eb1d2c6c966a1 (diff)
downloadorg.eclipse.cdt-d3dcd92d8f41e7ead0fc1e0388ffc4cf74f1906b.tar.gz
org.eclipse.cdt-d3dcd92d8f41e7ead0fc1e0388ffc4cf74f1906b.tar.xz
org.eclipse.cdt-d3dcd92d8f41e7ead0fc1e0388ffc4cf74f1906b.zip
Bug 517581 Keep env var operation on merged vars the same.
If we are merging two env vars and the operations are both append or prepend, keep that as the operation instead of replace. Change-Id: I758a54b8903eabafac38bf2f3f7d7065c0373e70
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/EnvVarOperationProcessor.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/EnvVarOperationProcessor.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/EnvVarOperationProcessor.java
index 6f458aefcd..11729bd3ea 100644
--- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/EnvVarOperationProcessor.java
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/EnvVarOperationProcessor.java
@@ -51,16 +51,20 @@ public class EnvVarOperationProcessor {
case IEnvironmentVariable.ENVVAR_APPEND:{
String delimiter = added.getDelimiter();
return new EnvironmentVariable(name,
- performAppend(initial.getValue(),added.getValue(),delimiter),
-// IEnvironmentVariable.ENVVAR_APPEND,
- delimiter);
+ performAppend(initial.getValue(), added.getValue(), delimiter),
+ initial.getOperation() == IEnvironmentVariable.ENVVAR_APPEND
+ ? IEnvironmentVariable.ENVVAR_APPEND
+ : IEnvironmentVariable.ENVVAR_REPLACE,
+ delimiter);
}
case IEnvironmentVariable.ENVVAR_PREPEND:{
String delimiter = added.getDelimiter();
return new EnvironmentVariable(name,
- performPrepend(initial.getValue(),added.getValue(),delimiter),
-// IEnvironmentVariable.ENVVAR_PREPEND,
- delimiter);
+ performPrepend(initial.getValue(), added.getValue(), delimiter),
+ initial.getOperation() == IEnvironmentVariable.ENVVAR_PREPEND
+ ? IEnvironmentVariable.ENVVAR_PREPEND
+ : IEnvironmentVariable.ENVVAR_REPLACE,
+ delimiter);
}
case IEnvironmentVariable.ENVVAR_REPLACE:
default:
@@ -155,7 +159,7 @@ public class EnvVarOperationProcessor {
static public List<String> convertToList(String value, String delimiter){
if (value == null)
value = ""; //$NON-NLS-1$
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
int delLength = delimiter.length();
int valLength = value.length();
@@ -182,7 +186,7 @@ public class EnvVarOperationProcessor {
* removes duplicates
*/
static public List<String> removeDuplicates(List<String> value, List<String> duplicates){
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
Iterator<String> valueIter = value.iterator();
while(valueIter.hasNext()){
String curVal = valueIter.next();

Back to the top