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

Fix handling of cygdrive in scanner discovery

This commit is contained in:
Markus Schorn 2006-11-06 13:16:26 +00:00
parent 02e693474e
commit d5e1e3f2ea
2 changed files with 18 additions and 16 deletions

View file

@ -93,26 +93,25 @@ public abstract class AbstractGCCBOPConsoleParserUtility {
pwd = dir.removeFirstSegments(fBaseDirectory.segmentCount());
} else {
// check if it is a cygpath
if (dir.toString().startsWith("/cygdrive/")) { //$NON-NLS-1$
char driveLetter = dir.toString().charAt(10);
driveLetter = (Character.isLowerCase(driveLetter)) ? Character.toUpperCase(driveLetter) : driveLetter;
StringBuffer buf = new StringBuffer();
buf.append(driveLetter);
buf.append(':');
String drive = buf.toString();
pwd = dir.removeFirstSegments(2);
pwd = pwd.setDevice(drive);
pwd = pwd.makeAbsolute();
}
else {
pwd = dir;
}
pwd= convertCygpath(dir);
}
fDirectoryStack.addElement(pwd);
}
}
protected IPath popDirectory() {
protected IPath convertCygpath(IPath path) {
if (path.segmentCount() > 1 && path.segment(0).equals("cygdrive")) { //$NON-NLS-1$
StringBuffer buf = new StringBuffer(2);
buf.append(Character.toUpperCase(path.segment(1).charAt(0)));
buf.append(':');
path = path.removeFirstSegments(2);
path = path.setDevice(buf.toString());
path = path.makeAbsolute();
}
return path;
}
protected IPath popDirectory() {
int i = getDirectoryLevel();
if (i != 0) {
IPath dir = (IPath) fDirectoryStack.lastElement();

View file

@ -175,7 +175,10 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
*/
IPath getAbsolutePath(String filePath) {
IPath pFilePath;
if (filePath.startsWith("/") || filePath.startsWith("\\") || //$NON-NLS-1$ //$NON-NLS-2$
if (filePath.startsWith("/")) { //$NON-NLS-1$
return convertCygpath(new Path(filePath));
}
else if (filePath.startsWith("\\") || //$NON-NLS-1$
(!filePath.startsWith(".") && //$NON-NLS-1$
filePath.length() > 2 && filePath.charAt(1) == ':' &&
(filePath.charAt(2) == '\\' || filePath.charAt(2) == '/'))) {