From 1ca39e56f9431304d032b8a7dd29e4d8ef421912 Mon Sep 17 00:00:00 2001 From: Mikhail Sennikovsky Date: Mon, 28 Nov 2005 11:48:35 +0000 Subject: [PATCH] Fixed bugs with macro resolution in path entry calculation --- .../internal/core/ManagedBuildInfo.java | 128 +++++++++++------- 1 file changed, 82 insertions(+), 46 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java index 4f1afd237a5..8c59f47b8c4 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java @@ -1168,33 +1168,47 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { /** */ - private String processPath(String path, int context, Object obj) { + private List processPath(List list, String path, int context, Object obj) { final String EMPTY = ""; //$NON-NLS-1$ - final String QUOTE = "\""; //$NON-NLS-1$ - - if (path == null) { return EMPTY; } - String s = path; - if (context != 0) { - try { - s = ManagedBuildManager.getBuildMacroProvider().resolveValue(s, EMPTY, " ", context, obj); //$NON-NLS-1$ - } catch (BuildMacroException e) { + if (path != null) { + if (context != 0) { + try { + String paths[] = ManagedBuildManager.getBuildMacroProvider().resolveStringListValue(path, EMPTY, " ", context, obj); //$NON-NLS-1$ + if (paths != null) { + for(int i = 0; i < paths.length; i++){ + list.add(checkPath(paths[i])); + } + } + } catch (BuildMacroException e) { + } + } else { + list.add(checkPath(path)); } } - if (s == null) { s = path; } + return list; + } + + private String checkPath(String p){ + final String QUOTE = "\""; //$NON-NLS-1$ + final String EMPTY = ""; //$NON-NLS-1$ - if (s.length()> 1 && s.startsWith(QUOTE) && s.endsWith(QUOTE)) { - s = s.substring(1, s.length()-1); + if(p == null) + return EMPTY; + + if (p.length()> 1 && p.startsWith(QUOTE) && p.endsWith(QUOTE)) { + p = p.substring(1, p.length()-1); } - if ( ".".equals(s) ) { //$NON-NLS-1$ + if ( ".".equals(p) ) { //$NON-NLS-1$ String cwd = getCWD(); - if (cwd.length()>0) { s = cwd; } + if (cwd.length()>0) { p = cwd; } } - if (!(new Path(s)).isAbsolute()) { + if (!(new Path(p)).isAbsolute()) { String cwd = getCWD(); - if (cwd.length()>0) { s = cwd + "/" + s; } //$NON-NLS-1$ + if (cwd.length()>0) { p = cwd + "/" + p; } //$NON-NLS-1$ } - return s; + return p; + } /** @@ -1204,7 +1218,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo { public IPathEntry[] getManagedBuildValues() { List entries = new ArrayList(); int i=0; - IPathEntry[] a = getManagedBuildValues(IPathEntry.CDT_INCLUDE_FILE); + IPathEntry[] a = getManagedBuildValues(IPathEntry.CDT_INCLUDE); if (a != null) { for (i=0; i 0) { + List list = new ArrayList(); for (int k=0; k 1) ? tokens[1].trim() : new String(); // Make sure the current entries do not contain a duplicate