Case sensitive resource API on windows when looking for existing resources? [message #270530] |
Wed, 08 September 2004 01:39 |
Eclipse User |
|
|
|
I have been using method IResource findMember(IPath path); in a utility
function:
public static IResource getExistingResource(IPath absPath) {
IResource resource =
ResourcesPlugin.getWorkspace().getRoot().findMember(absPath) ;
if (resource != null && resource.exists()) {
return resource;
} else {
return null;
}
I am running on Windows XP (NTFS). At some point I noticed that if the
path's case doesn't agree with the workspace and/or filesystem that
findMember returned null.
At first I tried to circumvent this by using different functions
IContainer.getFolder(IPath) and IContainer.getFile(IPath). but they also
wouldn't find the existing resource if the path passed in had the wrong
capitalization. The functions always returned a non-null result but the
subsequent exists() would return false.
I believe that IWorkspaceRoot.getProject(String) was NOT case sensitive
but I looked at this late at night and can't vouch for this 100%.
(subsequent exists() returned true)
I didn't find appropriate hints in the javadocs of these functions. Is
there already an RFE for this?
My best guess is that the API's shouldn't/can't change but I still
wonder how to handle the situation somewhat gracefully.
My current "workaround" matches the path segments one by one as returned
by IContainer.members. Is there a better way to do this?
Another issue I am not sure how to workaround is that
Platform.asLocalURL(URL); also gets put off by the wrong case.
|
|
|
Powered by
FUDForum. Page generated in 0.03055 seconds