The question asked here shows how a file from a bundle can be referenced via a URL such as platform:/plugin/de.vogella.rcp.plugin.filereader/files/test.txt.
I would like to have two versions of the same bundle running simultaneously and the file I am retrieving will be different across versions. Is it possible to reference a bundle with the above URL scheme using version information as well so I can get the correct version of the file?
If this is not possible, can a specific version of a bundle be retrieved by another means?
You have a few options. Appending the version to the plugin name, separated by an underscore, should work, although I can’t try it out right now to confirm that form works with the platform URL handler. For example:
platform://my.bundle_3.1/some/file.txt.Failing that, you can use the OSGi APIs directly. If you have a
BundleContext, you can use it to look up the exact bundle you want, and then callbundle.getResource()to get the resource you want.