diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreHostFile.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreHostFile.java index c63a7d8e17d..19e91175a27 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreHostFile.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreHostFile.java @@ -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$ diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFile.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFile.java index cedbb81829a..a218986359f 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFile.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFile.java @@ -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); }