Getting Linux path on Windows [message #673598] |
Tue, 24 May 2011 04:29  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.06618 seconds