I am doing serialization, which also contains the IFile path that needs to be saved as a string.
I am using this IFile in a plugin project. To debug or start, Eclipse launches a new workspace. This test workspace has a root somewhere relative to the plugin folder. My problem is that when I turn my IFile into an absolute path, my Eclipse test space treats the file as outside the workspace and throws exceptions. If I use the relative path of the project, creating the IFile from the string fails, and the IFile is null.
I really want to believe that it works the way I need it, but I really would like to see it. Is there a way to restore a valid IFile from a relative project path?
I am currently doing a reconstruction from String-> IFile as follows:
//name is a string with the absolute path IPath location = new Path(name); IFile file = project.getFile(location.lastSegment());
But, as already mentioned, it only works with an absolute path that does not work in the eclipse test space.
Thanks for the tip
source share