1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-09 10:05:24 +02:00

fix for windows drives

This commit is contained in:
David McKnight 2006-09-21 14:08:44 +00:00
parent 7dd2630664
commit 402f5458e3

View file

@ -79,6 +79,10 @@ public class DStoreHostFile implements IHostFile
String path = _element.getName(); String path = _element.getName();
return getNameFromPath(path); return getNameFromPath(path);
} }
else if (isRoot())
{
return _element.getValue();
}
else else
{ {
String name = _element.getName(); String name = _element.getName();
@ -86,7 +90,8 @@ public class DStoreHostFile implements IHostFile
if (name.length() == 0 && if (name.length() == 0 &&
(parentPath.equals("/") || parentPath.endsWith(":\\"))) (parentPath.equals("/") || parentPath.endsWith(":\\")))
{ {
return getParentPath();
return parentPath;
} }
return name; return name;
} }
@ -108,6 +113,11 @@ public class DStoreHostFile implements IHostFile
// derive from value // derive from value
String fullPath = _element.getValue(); String fullPath = _element.getValue();
int sep = fullPath.lastIndexOf('/'); int sep = fullPath.lastIndexOf('/');
if (sep == -1)
sep = fullPath.lastIndexOf('\\');
if (sep == -1)
return fullPath;
return fullPath.substring(0, sep); return fullPath.substring(0, sep);
} }
else else
@ -157,7 +167,7 @@ public class DStoreHostFile implements IHostFile
public boolean isRoot() public boolean isRoot()
{ {
String parentPath = getParentPath(); String parentPath = _element.getValue();
String name = _element.getName(); String name = _element.getName();
if (parentPath == null || parentPath.length() == 0 || if (parentPath == null || parentPath.length() == 0 ||
(name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\"))) (name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\")))