开发者

Platform.getBundle().getEntry() - how to get complete file URI

开发者 https://www.devze.com 2023-01-15 22:12 出处:网络
开发者_JS百科I am trying to generate the fullURI of a file(a .javajet template) to read it a generate code out of it.
开发者_JS百科

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().

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号