From 83c6521896bf556682368576856d7161a1f21209 Mon Sep 17 00:00:00 2001 From: David Inglis Date: Tue, 5 Oct 2004 23:50:17 +0000 Subject: [PATCH] fixed bug #75685 --- .../make/internal/core/BuildInfoFactory.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java index 29363a49ada..654972be8bf 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/BuildInfoFactory.java @@ -235,12 +235,14 @@ public class BuildInfoFactory { protected Map decodeMap(String value) { Map map = new HashMap(); StringBuffer envStr = new StringBuffer(value); + String escapeChars = "|\\"; + char escapeChar = '\\'; try { while (envStr.length() > 0) { int ndx = 0; while (ndx < envStr.length() ) { - if (envStr.charAt(ndx) == '|') { - if (envStr.charAt(ndx - 1) == '\\') { // escaped '|' - remove '\' and continue on. + if (escapeChars.indexOf(envStr.charAt(ndx)) != -1) { + if (envStr.charAt(ndx - 1) == escapeChar) { // escaped '|' - remove '\' and continue on. envStr.deleteCharAt(ndx - 1); } else { break; @@ -252,7 +254,7 @@ public class BuildInfoFactory { int lndx = 0; while (lndx < line.length() ) { if (line.charAt(lndx) == '=') { - if (line.charAt(lndx - 1) == '\\') { // escaped '=' - remove '\' and continue on. + if (line.charAt(lndx - 1) == escapeChar) { // escaped '=' - remove '\' and continue on. line.deleteCharAt(lndx - 1); } else { break; @@ -273,19 +275,19 @@ public class BuildInfoFactory { Iterator entries = values.entrySet().iterator(); while (entries.hasNext()) { Entry entry = (Entry) entries.next(); - str.append(escapeChars((String) entry.getKey(), "=|")); //$NON-NLS-1$ + str.append(escapeChars((String) entry.getKey(), "=|\\", '\\')); //$NON-NLS-1$ str.append("="); //$NON-NLS-1$ - str.append(escapeChars((String) entry.getValue(), "|")); //$NON-NLS-1$ + str.append(escapeChars((String) entry.getValue(), "|\\", '\\')); //$NON-NLS-1$ str.append("|"); //$NON-NLS-1$ } return str.toString(); } - protected String escapeChars(String string, String escapeChars) { + protected String escapeChars(String string, String escapeChars, char escapeChar) { StringBuffer str = new StringBuffer(string); for(int i = 0; i < str.length(); i++) { - if ( escapeChars.indexOf(str.charAt(i)) != -1 ) { - str.insert(i, '\\'); + if ( escapeChars.indexOf(str.charAt(i)) != -1) { + str.insert(i, escapeChar); i++; } }