Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Location of linked resource
Location of linked resource [message #326709] Sun, 30 March 2008 13:30 Go to next message
Leif Frenzel is currently offline Leif FrenzelFriend
Messages: 23
Registered: July 2009
Junior Member
Hi,

When I run this code:

[snip]
IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
IProject project = wsRoot.getProject( "p" );
project.create( null );
project.open( null );

IFolder folder = project.getFolder( "f" );
folder.createLink( new Path( "/tmp/f/" ), IResource.ALLOW_MISSING_LOCAL,
null );

System.out.println( folder.getLocation() );
System.out.println( folder.getRawLocation() );
System.out.println( folder.getLocationURI() );
[snap]

I'm getting:

[snip]
/private/tmp/f
/private/tmp/f
file:/private/tmp/f
[snap]

Which is a bit surprising: where does the 'private' come from? Am I
missing something? How can I get to the correct local path of the linked
folder?

I'm on Mac (OS X 10.5.2) using Eclipse 3.3.2.

Thanks for any help && ciao,
Leif
Re: Location of linked resource [message #326733 is a reply to message #326709] Mon, 31 March 2008 12:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Leif Frenzel wrote:
> Hi,
>
> When I run this code:
>
> [snip]
> IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
> IProject project = wsRoot.getProject( "p" );
> project.create( null );
> project.open( null );
>
> IFolder folder = project.getFolder( "f" );
> folder.createLink( new Path( "/tmp/f/" ), IResource.ALLOW_MISSING_LOCAL,
> null );
>
> System.out.println( folder.getLocation() );
> System.out.println( folder.getRawLocation() );
> System.out.println( folder.getLocationURI() );
> [snap]
>
> I'm getting:
>
> [snip]
> /private/tmp/f
> /private/tmp/f
> file:/private/tmp/f
> [snap]
>
> Which is a bit surprising: where does the 'private' come from? Am I
> missing something? How can I get to the correct local path of the linked
> folder?

Are you certain that the project is not located in the directory named
/private ?

Eric
Re: Location of linked resource [message #326744 is a reply to message #326733] Mon, 31 March 2008 14:10 Go to previous messageGo to next message
Leif Frenzel is currently offline Leif FrenzelFriend
Messages: 23
Registered: July 2009
Junior Member
Yes, the project is in /Users/leif/workspaces/junit-workspace/ (I'm
running the code out of a PDE JUnit test.)

And even if it was: the location should be the actual location on the file
system, i.e. /tmp/f/, not the location of the project plus the folder's
path. In order words, I'd expect the result to be /tmp/f/ and not
/Users/leif/workspaces/junit-workspace/p/f/

(Btw: I've just done a quick check with Eclipse 3.2.2 on Windows, and it
seems to be ok there.)

Thanks && ciao,
Leif
Re: Location of linked resource [message #326757 is a reply to message #326744] Mon, 31 March 2008 18:27 Go to previous message
Leif Frenzel is currently offline Leif FrenzelFriend
Messages: 23
Registered: July 2009
Junior Member
Hi again,

I did some research and it seems /tmp/ on Macs generally is symlinked to
/private/tmp/, along with other standard unix folders. So Eclipse must
resolve the symlink at some point, and when getting the location we end up
with the resolved path. (I can live with that for my immediate purpose,
although I'm somewhat unhappy with an asymmetric behaviour like this -
setting some path and then directly asking for it should return the same
path again, I would expect.)

Sorry for the noise,
Thanks && ciao,
Leif
Previous Topic:View/Editor/Perspective independent key bindings?
Next Topic:Incoming Change Sets as Patches?
Goto Forum:
  


Current Time: Thu Dec 26 16:52:22 GMT 2024

Powered by FUDForum. Page generated in 0.03300 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top