mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-17 14:05:23 +02:00
[181667] windows get parent path fixes
This commit is contained in:
parent
5cfd747882
commit
9b16d8af74
2 changed files with 47 additions and 7 deletions
|
@ -189,8 +189,10 @@ public class DStoreHostFile implements IHostFile
|
||||||
{
|
{
|
||||||
String parentPath = _element.getValue();
|
String parentPath = _element.getValue();
|
||||||
String name = _element.getName();
|
String name = _element.getName();
|
||||||
if (parentPath == null || parentPath.length() == 0 ||
|
if (parentPath == null ||
|
||||||
(name.length() == 0 && (parentPath.equals("/") || parentPath.endsWith(":\\"))) //$NON-NLS-1$ //$NON-NLS-2$
|
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
|
// set the absolute path
|
||||||
String name = _element.getName();
|
String name = _element.getName();
|
||||||
|
String value = _element.getValue();
|
||||||
if (name == null)
|
if (name == null)
|
||||||
{
|
{
|
||||||
// this element is deleted
|
// this element is deleted
|
||||||
|
@ -250,7 +253,7 @@ public class DStoreHostFile implements IHostFile
|
||||||
}
|
}
|
||||||
else if (name.length() == 0)
|
else if (name.length() == 0)
|
||||||
{
|
{
|
||||||
_absolutePath = _element.getValue();
|
_absolutePath = value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -264,6 +267,10 @@ public class DStoreHostFile implements IHostFile
|
||||||
{
|
{
|
||||||
_absolutePath = PathUtility.normalizeUnknown(parentPath);
|
_absolutePath = PathUtility.normalizeUnknown(parentPath);
|
||||||
}
|
}
|
||||||
|
else if (name == value)
|
||||||
|
{
|
||||||
|
_absolutePath = name;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_absolutePath = PathUtility.normalizeUnknown(parentPath + "/" + name); //$NON-NLS-1$
|
_absolutePath = PathUtility.normalizeUnknown(parentPath + "/" + name); //$NON-NLS-1$
|
||||||
|
|
|
@ -67,6 +67,10 @@ public class DStoreFile extends AbstractRemoteFile implements IRemoteFile
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
else if (pathOnly.equals(getAbsolutePath()))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
else if (pathOnly.length() == 1)
|
else if (pathOnly.length() == 1)
|
||||||
{
|
{
|
||||||
// parentFile is already null
|
// parentFile is already null
|
||||||
|
@ -97,6 +101,10 @@ public class DStoreFile extends AbstractRemoteFile implements IRemoteFile
|
||||||
{
|
{
|
||||||
parentName = pathOnly.substring(nameSep + 1);
|
parentName = pathOnly.substring(nameSep + 1);
|
||||||
parentPath = pathOnly.substring(0, nameSep);
|
parentPath = pathOnly.substring(0, nameSep);
|
||||||
|
if (parentPath.endsWith(":"))
|
||||||
|
{
|
||||||
|
parentPath = parentPath + sep;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -113,11 +121,36 @@ public class DStoreFile extends AbstractRemoteFile implements IRemoteFile
|
||||||
//parentFile = ss.getRemoteFileObject(pathOnly+sep);
|
//parentFile = ss.getRemoteFileObject(pathOnly+sep);
|
||||||
}
|
}
|
||||||
else
|
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);
|
//parentFile = ss.getRemoteFileObject(pathOnly);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue