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
Messages: 108
Registered: February 2010
Location: France
Senior Member
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


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 Webster
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 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 Sep 16 00:56:53 GMT 2014

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

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