Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gvozdev2009-12-27 00:56:00 +0000
committerAndrew Gvozdev2009-12-27 00:56:00 +0000
commit1df18c902a4f969037d2df655fa215471d51e53a (patch)
treee8ed20df05ee264a5c67869396c7d5c2736cbf9e
parent6e991ccbc5c167f3f0173e9f767f73b207da1d39 (diff)
downloadorg.eclipse.cdt-1df18c902a4f969037d2df655fa215471d51e53a.tar.gz
org.eclipse.cdt-1df18c902a4f969037d2df655fa215471d51e53a.tar.xz
org.eclipse.cdt-1df18c902a4f969037d2df655fa215471d51e53a.zip
bug 284843: Environment Variable with value ":" gets replaced by empty string ""
Patch from Marc-Andre Laperle
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java
index c01ce8ae877..d7a2c854dba 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/cdtvariables/EnvironmentVariableSupplier.java
@@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core.cdtvariables;
import java.util.List;
+import java.util.regex.Pattern;
import org.eclipse.cdt.core.cdtvariables.CdtVariable;
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
@@ -42,7 +43,7 @@ public class EnvironmentVariableSupplier extends CoreMacroSupplierBase {
String value = var.getOperation() != IEnvironmentVariable.ENVVAR_REMOVE ?
var.getValue() : null;
- if(delimiter != null && !"".equals(delimiter)){ //$NON-NLS-1$
+ if(isTextList(value,delimiter)){
fType = VALUE_TEXT_LIST;
if(value != null){
List<String> list = EnvVarOperationProcessor.convertToList(value,delimiter);
@@ -99,6 +100,15 @@ public class EnvironmentVariableSupplier extends CoreMacroSupplierBase {
fEnvironmentProvider = varProvider;
}
+ private static boolean isTextList(String str, String delimiter) {
+ if (delimiter == null || "".equals(delimiter)) //$NON-NLS-1$
+ return false;
+
+ // Regex: ([^:]+:)+[^:]*
+ String patternStr = "([^" + delimiter + "]+" + delimiter + ")+[^" + delimiter + "]*"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
+ return Pattern.matches(patternStr, str);
+ }
+
public ICdtVariable createBuildMacro(IEnvironmentVariable var){
if(var != null)
return new EnvVarMacro(var);

Back to the top