Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Getting Linux path on Windows(ResourcesPlugin.getWorkspace().getRoot() returns "/")
Getting Linux path on Windows [message #673598] Tue, 24 May 2011 08:29 Go to next message
MaximeLecourt  is currently offline MaximeLecourt Friend
Messages: 108
Registered: February 2010
Location: France
Senior Member

I'm having trouble with paths under WindowsXP.

public IFile getFile(String path) {
	IPath ipath = new Path(path);
	IFile res = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(ipath);
	if(res == null)
		res = ResourcesPlugin.getWorkspace().getRoot().getFile(ipath);
	return res;

I call that function with a windows path String.
The IPath is ok, device and path are still good.
But once I try to turn it to IFile, res looses the device, and returns a Linux path (so instead of D:\the\way\to\my.file, I get /the/way/to/my.file).

Any subsequent use of the resulting IFile fails, of course, as it searches a file with a Linux path on a Windows system.
Is that a bug or am I doing some things wrong ?



One day I shall master M2T, but that day has yet to come...
Re: Getting Linux path on Windows [message #673706 is a reply to message #673598] Tue, 24 May 2011 14:08 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

All paths within a workspace are "/the/way/to/my.file", as they're relative to the workspace root.

An IFile also only exists within the workspace, and so doesn't have information for dealing with devices.

What are you trying to do exactly? You seem to be working within a workspace. What are you trying to pass in as input? An absolute path to a file that lives in a workspace?


Previous Topic:Binding conflicts
Next Topic:Core expressions framework behaviour
Goto Forum:

Current Time: Mon Jun 25 06:30:44 GMT 2018

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

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

Back to the top