Skip to main content



      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 04:29 Go to next message
Eclipse UserFriend
Hi,

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 ?

Thanks

Maxime
Re: Getting Linux path on Windows [message #673706 is a reply to message #673598] Tue, 24 May 2011 10:08 Go to previous message
Eclipse UserFriend
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 java.io.File path to a file that lives in a workspace?

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


Current Time: Tue Jul 01 09:05:43 EDT 2025

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

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

Back to the top