Platform.getBundle().getEntry() - how to get complete file URI
I am trying to generate the fullURI of a file(a .javajet template) to read it a generate code out of it. When I get the Platform.getBundle(pluginId()).getEntry("/") it gives me the following string :
bundleentry://1074.fwk5184781/templates/FlowMain.javajet which is obviously wrong and hence the template file is not found. The code is as follows :
private String getUri(String pluginId, String relativeUri) { String base = Platform.getBundle(pluginId).getEntry("/").toString(); String result = base + relativeUri; return result; }
Any idea on how to get the complete URI of this file ?
To get the workspace location you can use Platform.getLocation()
. Doc
If you have a handle on your project you can also use IProject.getLocation()
to get the location of the project.
Or you can just call IFile..getFullPath()
.
精彩评论