Cybran
Cybran

Reputation: 2313

Append to PATH environment variable in Eclipse

How can I append or prepend a custom directory to the PATH environment variable in Eclipse CDT?

I am referring to the environment variables which can be specified at these locations:

The custom directory should be prepended or appended to the PATH environment variable used by Eclipse itself (referred to as "native environment"). Attempting to set it the usual way (PATH=/my/custom/directory:${PATH}) does not work for launch configurations.

Upvotes: 1

Views: 4184

Answers (1)

howlger
howlger

Reputation: 34135

In a launch configuration you can use the env_var variable with the argument PATH:

${env_var:PATH}

Since plug-ins can contribute variables (e.g. git_branch by EGit) there is no documentation with a list of all variables and their arguments. In the New/Edit Environment Variable dialog, if you click Variables... and select the env_var variable, there is the following description at the bottom of the dialog (in my view the screenshot with env_var without arguments shown in the C/C++ Development User Guide is not correct here):

Returns the value of an environment variable. An environment variable name must be specified as an argument.

In the C/C++ build environment, I would assume this would work too. But you've already found out that ${PATH} works here for sure.

Upvotes: 4

Related Questions