Suspected inconsistencies in URIHandler.exist [message #1849829] |
Thu, 03 February 2022 16:50 |
Sebastian Zarnekow Messages: 3117 Registered: July 2009 |
Senior Member |
|
|
Hello,
when we tried to decouple our code from concrete file system implementations (java.io, org.eclipse.core.resources), we thought it might be a great idea to base most of the IO work on the abstraction of URIs and URIConverter.
After all, URIConverter offers almost everything one needs to work with resources.
When we were testing this in an Eclipse environment that also uses virtual folders, we figured some inconsistencies between the PlatformResourceURIHandlerImpl and FileURIHandlerImpl.
The FileURIHandlerImpl will happily answer a query for exists() with true, if it refers to a directory, whereas the PlatformResourceURIHandlerImpl doesn't agree to that for virtual folders. It resorts to the WorkbenchHelper
public static boolean exists(String platformResourcePath, Map<?, ?> options)
{
IResource resource = getWorkspaceRoot().findMember(new Path(platformResourcePath));
return resource != null && resource.getResourceAttributes() != null;
}
Is there a reason why this isn't implemented by means of `resource.exists()` but rejects virtual resources?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01644 seconds