1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

bug 357442: Contribute $CYGWIN_HOME by GnuCygwinConfigurationEnvironmentSupplier only if it does not come from preferences

This commit is contained in:
Andrew Gvozdev 2013-03-09 19:54:33 -05:00
parent 6190dce232
commit 2bccd66416

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2012 Intel Corporation and others.
* Copyright (c) 2005, 2013 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -19,7 +19,6 @@ import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
/**
@ -50,16 +49,15 @@ public class GnuCygwinConfigurationEnvironmentSupplier implements IConfiguration
return new BuildEnvVar(ENV_PATH, path, IBuildEnvironmentVariable.ENVVAR_PREPEND);
} else if (variableName.equals(Cygwin.ENV_CYGWIN_HOME)) {
IEnvironmentVariable varCygwinHome = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(Cygwin.ENV_CYGWIN_HOME, null, false);
if (varCygwinHome == null) {
// Contribute if the variable does not already come from workspace environment
String home = Cygwin.getCygwinHome();
// If the variable is not defined still show it in the environment variables list as a hint to user
if (home == null) {
// If the variable is not defined still show it in the environment variables list as a hint to user
home = ""; //$NON-NLS-1$
}
IPath homePath = new Path(home);
IEnvironmentVariable varCygwinHome = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(Cygwin.ENV_CYGWIN_HOME, null, false);
if (varCygwinHome == null || (!homePath.equals(new Path(varCygwinHome.getValue())))) {
// Contribute if the variable does not already come from workspace environment
return new BuildEnvVar(Cygwin.ENV_CYGWIN_HOME, homePath.toOSString());
return new BuildEnvVar(Cygwin.ENV_CYGWIN_HOME, new Path(home).toOSString());
}
return null;