can't open file in root directory on Mac OS X with ResourcesPlugin.getWorkspace().getRoot().getFile [message #544296] |
Fri, 02 July 2010 05:14  |
Eclipse User |
|
|
|
Hello Everyone,
I've noticed a strange problem, and I don't know whether I don't use the correct service or this is a bug, but I guess it's the first one.
I try to open a a file this way:
ResourcesPlugin.getWorkspace().getRoot().getFile(path);
and if it is in the absolute root directory (e.g. /sth.txt) I got:
message = "Path must include project and resource name: " + path.toString();
from Workspace.newResource, because
path.segmentCount() < ICoreConstants.MINIMUM_FILE_SEGMENT_LENGTH
returns false (segment count is 1, since the path is /sth.txt).
This method works if I don't take a file from the root but from some other directory under /.
Could someone tell what is the solution for this issue?
thanks
david
|
|
|
Re: can't open file in root directory on Mac OS X with ResourcesPlugin.getWorkspace().getRoot().getF [message #544640 is a reply to message #544296] |
Mon, 05 July 2010 03:42  |
Eclipse User |
|
|
|
david borsodi wrote:
> Hello Everyone,
>
> I've noticed a strange problem, and I don't know whether I don't use
> the correct service or this is a bug, but I guess it's the first one.
>
> I try to open a a file this way:
> ResourcesPlugin.getWorkspace().getRoot().getFile(path);
> and if it is in the absolute root directory (e.g. /sth.txt) I got:
> message = "Path must include project and resource name: " +
> path.toString();
> from Workspace.newResource, because path.segmentCount() <
> ICoreConstants.MINIMUM_FILE_SEGMENT_LENGTH
> returns false (segment count is 1, since the path is /sth.txt).
> This method works if I don't take a file from the root but from some
> other directory under /.
> Could someone tell what is the solution for this issue?
First, I suggest to read a little bit more about what a workspace (root)
is and how it is structured.
Dani
> thanks
> david
|
|
|
Powered by
FUDForum. Page generated in 0.24761 seconds