1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 15:45:25 +02:00

[181667] windows get parent path fixes

This commit is contained in:
David McKnight 2007-04-27 16:16:49 +00:00
parent 5cfd747882
commit 9b16d8af74
2 changed files with 47 additions and 7 deletions

View file

@ -189,8 +189,10 @@ public class DStoreHostFile implements IHostFile
{
String parentPath = _element.getValue();
String name = _element.getName();
if (parentPath == null || parentPath.length() == 0 ||
(name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\"))) //$NON-NLS-1$ //$NON-NLS-2$
if (parentPath == null ||
parentPath.length() == 0 ||
(name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\")) ||
(name.equals(parentPath) && parentPath.endsWith(":\\"))) //$NON-NLS-1$ //$NON-NLS-2$ // %NON-NLS-3$
)
{
@ -243,6 +245,7 @@ public class DStoreHostFile implements IHostFile
{
// set the absolute path
String name = _element.getName();
String value = _element.getValue();
if (name == null)
{
// this element is deleted
@ -250,7 +253,7 @@ public class DStoreHostFile implements IHostFile
}
else if (name.length() == 0)
{
_absolutePath = _element.getValue();
_absolutePath = value;
}
else
{
@ -264,6 +267,10 @@ public class DStoreHostFile implements IHostFile
{
_absolutePath = PathUtility.normalizeUnknown(parentPath);
}
else if (name == value)
{
_absolutePath = name;
}
else
{
_absolutePath = PathUtility.normalizeUnknown(parentPath + "/" + name); //$NON-NLS-1$

View file

@ -67,6 +67,10 @@ public class DStoreFile extends AbstractRemoteFile implements IRemoteFile
{
return null;
}
else if (pathOnly.equals(getAbsolutePath()))
{
return null;
}
else if (pathOnly.length() == 1)
{
// parentFile is already null
@ -97,6 +101,10 @@ public class DStoreFile extends AbstractRemoteFile implements IRemoteFile
{
parentName = pathOnly.substring(nameSep + 1);
parentPath = pathOnly.substring(0, nameSep);
if (parentPath.endsWith(":"))
{
parentPath = parentPath + sep;
}
}
else
{
@ -113,11 +121,36 @@ public class DStoreFile extends AbstractRemoteFile implements IRemoteFile
//parentFile = ss.getRemoteFileObject(pathOnly+sep);
}
else
{DataStore ds = _dstoreHostFile.getDataElement().getDataStore();
DataElement element = ds.createObject(null, IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR, pathOnly);
{
DataStore ds = _dstoreHostFile.getDataElement().getDataStore();
DStoreHostFile hostParent = new DStoreHostFile(element);
parentFile = new DStoreFile((FileServiceSubSystem)ss, _context, (IRemoteFile)null, hostParent);
IHostFile hostParent = fileService.getHostFile(pathOnly);
if (hostParent == null)
{
int nameSep = pathOnly.lastIndexOf(sep);
String parentName = pathOnly;
String parentPath = pathOnly;
if (nameSep > 0)
{
parentName = pathOnly.substring(nameSep + 1);
parentPath = pathOnly.substring(0, nameSep);
if (parentPath.endsWith(":"))
{
parentPath = parentPath + sep;
}
}
else
{
parentName = pathOnly.substring(nameSep + 1);
parentPath = "" + sep;
}
DataElement element = ds.createObject(null, IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR, parentName);
element.setAttribute(DE.A_VALUE, parentPath);
hostParent = new DStoreHostFile(element);
}
parentFile = new DStoreFile((FileServiceSubSystem)ss, _context, (IRemoteFile)null, (DStoreHostFile)hostParent);
//parentFile = ss.getRemoteFileObject(pathOnly);
}