Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Accessing PATH Environment Variable

This may be a dumb question, but why can't you use System.getenv("PATH")?

--
Derek


Sanchali G. Kshirsagar wrote:
Hello Everybody,

We have integrated our toolchain in MBS and we need the “PATH” Environment Variable for referring the paths in Applicability Calculators. Following is the code we are using to get the variable.

IBuildEnvironmentVariable vars[] = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(configuration,

*true*, *true*);

                        *if*(vars != *null*){

String env[] = *new* String[vars.length];

*for* (*int* i = 0; i < env.length; i++) {

*if* (vars[i].getName().equalsIgnoreCase("path")) {

String value = vars[i].getValue();

*if* (value != *null*) {

toolChainEnvPath = vars[i].getValue();

*break*;

                                                            }

                                                }

                                    }

                        }

But we have observed that this code does not work on all machines. For some PC’s we do not get “PATH” variable in the above vars array. Could anybody tell us is this the correct way to take the “PATH” variable or is there any other method? We have also tried the configuration and toolchain’s Environment Variable provider, but with the same result.

Regards,

*Sanchali Kshirsagar*


------------------------------------------------------------------------

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top