diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/BuildDescriptionManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/BuildDescriptionManager.java index 07a5407fb66..36c876943d9 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/BuildDescriptionManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/buildmodel/BuildDescriptionManager.java @@ -286,19 +286,23 @@ public class BuildDescriptionManager { if(!location.isAbsolute()) return location; - IPath path = null; +// IPath path = null; IPath tmp = cwd; + StringBuffer buf = null; while(tmp.segmentCount() != 0){ if(tmp.isPrefixOf(location)){ IPath p = location.removeFirstSegments(tmp.segmentCount()).setDevice(null); - if(path == null) + if(buf == null) return p; - return path.append(p); + buf.append(p.makeRelative().toString()); + return new Path(buf.toString()); + } + if(buf == null){ + buf = new StringBuffer(); + buf.append("../"); //$NON-NLS-1$ + } else { + buf.append("../"); //$NON-NLS-1$ } - if(path == null) - path = new Path(".."); //$NON-NLS-1$ - else - path.append(".."); //$NON-NLS-1$ tmp = tmp.removeLastSegments(1); }