Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » can't open file in root directory on Mac OS X with ResourcesPlugin.getWorkspace().getRoot().getFile
can't open file in root directory on Mac OS X with ResourcesPlugin.getWorkspace().getRoot().getFile [message #544296] Fri, 02 July 2010 05:14 Go to next message
david borsodi is currently offline david borsodi
Messages: 19
Registered: July 2009
Junior Member
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 Go to previous message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
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
Previous Topic:Bug 277411 workaround somewhere?
Next Topic:hyperlinkDetectors and hyperlinkDetectorTargets
Goto Forum:
  


Current Time: Sun Aug 31 00:28:53 EDT 2014

Powered by FUDForum. Page generated in 0.02073 seconds