Hello,
I am trying to set global environment variables programmatically. The most elegant method, using public/non-internal APIs I found is:
IContributedEnvironment environment = CCorePlugin.getDefault().getBuildEnvironmentManager().getContributedEnvironment();
environment.addVariable("MY_VAR", "TEST_VALUE",IEnvironmentVariable.ENVVAR_REPLACE, null, null);
This works fine, but it is not persistent (i.e. the variable is lost when the workspace is restarted). After looking through the CDT sources, the only/best/suitable way I found is using:
EnvironmentVariableManager.fUserSupplier.storeWorkspaceEnvironment(true);
which seems to be working...
But this unfortunately uses the CDT internal API (which I suppose is a 'bad thing' to use?). I am not able to find any other public method/API that (indirectly) call this storeWorkspaceEnvironment() method.
Is there any way of modifying CDT environment variables persistently while only using the public API?
Thanks,
Maarten
[Updated on: Mon, 15 September 2014 12:51]
Report message to a moderator