mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 13:05:22 +02:00
[241327] IRemoteFile.getParentName returns null for ssh, ftp, dstore, and local
This commit is contained in:
parent
ce88f4944c
commit
e8ca55189b
1 changed files with 10 additions and 3 deletions
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue