java - Find resources in project tree -
i have plugin project , need method find , open file in project plugin run. have in variable name of file should inside project. how can done ?
thank !
for file resource inside plug-in:
bundle bundle = activator.getdefault().getbundle("com.your.plugin.name"); if (bundle != null) { url fileurl; try { fileurl = filelocator.tofileurl(bundle.getentry("/path/to/your/file/from/the/plugin/root")); string filesystempathtoyourfile = fileurl.getpath()); } catch (ioexception exception) { // ... } }
of course, you'll have make sure corresponding resource included in plug-in's binary build (bin.include property in build.properties file, or binary build section in build tab of plug-in manifest editor).
if file jar, may have export plug-in directory (not 100% sure, may depend of jar resource - add project's build path or launch configuration classpath).
Comments
Post a Comment