Friday, May 7, 2010

How to load a file placed inside a plugin ?

String pluginID = "com.examples.eclipse.test";
String baseSegment = "Samples";
String fileName = "testProject.zip";

org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI
.createPlatformPluginURI(pluginID, true);
uri = uri.appendSegments(new String[] { baseSegment, fileName});

uri = CommonPlugin.resolve(uri);

String path = uri.toFileString();

File resolvedFile = new File(path);

No comments: