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

[241327] IRemoteFile.getParentName returns null for ssh, ftp, dstore, and local

This commit is contained in:
David McKnight 2008-11-11 15:29:43 +00:00
parent ce88f4944c
commit e8ca55189b

View file

@ -170,9 +170,16 @@ public abstract class AbstractRemoteFile extends RemoteFile
*/ */
public String getParentName() public String getParentName()
{ {
String parentPath = getParentPath(); if (_parentFile != null) // optimization if we have the parentFile
String parentName = getNameFromPath(parentPath); return _parentFile.getName(); // if we had used getParentFile(), the operation may have been more
return parentName; // expensive than just using the parent path
else {
String parentPath = getParentPath();
if (parentPath == null) // parentPath may be null - avoid NPE
return null;
else
return getNameFromPath(parentPath);
}
} }
/** /**