Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse OSGI config: relative paths and/or @config.dir-like substitutions?

In my RCP app, I would like to point a property (osgi.java.profile) to a file, and would prefer using paths relative to my installation and config dir.

Is there a definitive spec on what kind of variables are supported in config.ini?


@config.dir seems to be supported, there are references in the builtin, and it's always mentioned as typical example (e.g this SO answer ) However, looking at docs like Eclipse help/Runtime Options, it mentions a few "symbolic locations" like @user.home; however that seems fairly limited and doesn't include @config.dir.

Have even dug into org.eclipse.osgi sources as well, and found no references to this (I did find LocationManager and its hard coded variable substitutions for @user.dir & co). Can I refer to arbitrary system properties there in some way?

Is this @config.dir a special case, only handled by P2? UPDATE: this seems to be the case.. looking at Eclipse SDK, About .. Configuration dialog shows @config.dir unresolved, probably taken literally by the Equinox..

Thanks for any hints.

like image 437
inger Avatar asked Feb 09 '11 17:02

inger


2 Answers

I'm late to the party, but hopefully this will help others in the future.

Starting with Eclipse 3.8/4.2 (June 2012), you can substitute Java properties and environment variables into your config.ini file (Eclipse Bug 241192). The Equinox launcher does not support substitution in the eclipse.ini launcher file. The syntax uses dollar signs ($VARIABLE$) to indicate variable substitution:

osgi.configuration.area=$APPDATA$/MyCompany/MyProgram/configuration
osgi.user.area=$APPDATA$/MyCompany/MyProgram/user
osgi.instance.area=$APPDATA$/MyCompany/MyProgram/instance

I imagine you could use something like this for your purposes:

osgi.java.profile=$osgi.install.area$/path/to/profile.txt
like image 51
Steven Darnell Avatar answered Sep 24 '22 19:09

Steven Darnell


You can use a platform URL (Platform URI scheme) to achieve this, i.e.

osgi.java.profile = platform:/config/java_profile.txt

in config.ini, would point to the file java_profile.txt in the current configuration directory.

You might also use existing system properties in config.ini:

osgi.java.profile = ${osgi.configuration.area}/java_profile.txt
like image 40
tkotisis Avatar answered Sep 23 '22 19:09

tkotisis