Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Persistently store global environment variables
Persistently store global environment variables [message #1424092] Mon, 15 September 2014 12:50
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
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

Previous Topic:Header dependencies are ignored
Next Topic:Help setting CDT Indexer include path programmatically
Goto Forum:
  


Current Time: Mon Jan 18 05:34:02 GMT 2021

Powered by FUDForum. Page generated in 0.01789 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top