1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

relative path calculation fixes on Linix

This commit is contained in:
Mikhail Sennikovsky 2007-06-15 16:26:55 +00:00
parent b7eb6a93b0
commit 786867b4be
2 changed files with 7 additions and 2 deletions

View file

@ -237,7 +237,7 @@ public class ManagedBuildCoreTests20 extends TestCase {
// This first path is a built-in, so it will not be manipulated by build manager // This first path is a built-in, so it will not be manipulated by build manager
expectedPaths[0] = (new Path("/usr/include")).toOSString(); expectedPaths[0] = (new Path("/usr/include")).toOSString();
expectedPaths[1] = (new Path("/opt/gnome/include")).toOSString(); expectedPaths[1] = (new Path("/opt/gnome/include")).toOSString();
IPath path = new Path("C:/home/tester/include"); IPath path = new Path("C:\\home\\tester/include");
if(path.isAbsolute()) // for win32 path is treated as absolute if(path.isAbsolute()) // for win32 path is treated as absolute
expectedPaths[2] = path.toOSString(); expectedPaths[2] = path.toOSString();
else // for Linux path is relative else // for Linux path is relative

View file

@ -10,6 +10,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.dataprovider; package org.eclipse.cdt.managedbuilder.internal.dataprovider;
import java.io.File;
import org.eclipse.cdt.core.cdtvariables.CdtVariableException; import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor; import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableSubstitutor;
@ -22,6 +24,9 @@ class PathInfo {
private String fAbsoluteInfoStr; private String fAbsoluteInfoStr;
private Boolean fIsAbsolute; private Boolean fIsAbsolute;
private SupplierBasedCdtVariableSubstitutor fSubstitutor; private SupplierBasedCdtVariableSubstitutor fSubstitutor;
private static final boolean IS_WINDOWS = File.separatorChar == '\\';
public PathInfo(String str, boolean isWspPath, SupplierBasedCdtVariableSubstitutor subst){ public PathInfo(String str, boolean isWspPath, SupplierBasedCdtVariableSubstitutor subst){
fUnresolvedStr = str; fUnresolvedStr = str;
@ -74,7 +79,7 @@ class PathInfo {
return false; return false;
char c1 = str.charAt(1); char c1 = str.charAt(1);
if(c1 == ':') if(IS_WINDOWS && c1 == ':')
return true; return true;
if(length < 4) if(length < 4)