mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 10:46:02 +02:00
Revert [from sd90] "bug 357442: Added $CYGWIN_HOME to cygwin toolchain detection algorithm"
This reverts commit 459437b14d
.
This commit is contained in:
parent
383cb93e57
commit
a3783e3f84
3 changed files with 57 additions and 100 deletions
|
@ -30,19 +30,17 @@ import org.eclipse.cdt.utils.PathUtil;
|
||||||
import org.eclipse.cdt.utils.WindowsRegistry;
|
import org.eclipse.cdt.utils.WindowsRegistry;
|
||||||
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
import org.eclipse.cdt.utils.spawner.ProcessFactory;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*/
|
*/
|
||||||
public class CygwinPathResolver implements IBuildPathResolver {
|
public class CygwinPathResolver implements IBuildPathResolver {
|
||||||
private static final String DEFAULT_ROOT = "C:\\cygwin"; //$NON-NLS-1$
|
private static final String DEFAULT_ROOT = "C:\\cygwin"; //$NON-NLS-1$
|
||||||
private static final String CYGWIN_DLL = "cygwin1.dll"; //$NON-NLS-1$
|
|
||||||
private static final String TOOL = "/cygpath -w -p "; //$NON-NLS-1$
|
private static final String TOOL = "/cygpath -w -p "; //$NON-NLS-1$
|
||||||
private static final char BS = '\\';
|
private static final char BS = '\\';
|
||||||
private static final char SLASH = '/';
|
private static final char SLASH = '/';
|
||||||
private static final String PROPERTY_OS_NAME = "os.name"; //$NON-NLS-1$
|
private static final String PROPERTY_OS_NAME = "os.name"; //$NON-NLS-1$
|
||||||
private static final String OS_WINDOWS = "windows";//$NON-NLS-1$
|
private static final String PROPERTY_OS_VALUE = "windows";//$NON-NLS-1$
|
||||||
private static final String SP = " "; //$NON-NLS-1$
|
private static final String SP = " "; //$NON-NLS-1$
|
||||||
private static final String REGISTRY_KEY_SETUP = "SOFTWARE\\Cygwin\\setup"; //$NON-NLS-1$
|
private static final String REGISTRY_KEY_SETUP = "SOFTWARE\\Cygwin\\setup"; //$NON-NLS-1$
|
||||||
private static final String REGISTRY_KEY_SETUP_WIN64 = "SOFTWARE\\Wow6432Node\\Cygwin\\setup"; //$NON-NLS-1$
|
private static final String REGISTRY_KEY_SETUP_WIN64 = "SOFTWARE\\Wow6432Node\\Cygwin\\setup"; //$NON-NLS-1$
|
||||||
|
@ -61,10 +59,7 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
||||||
private static final String MINGW_SPECIAL = "mingw "; //$NON-NLS-1$
|
private static final String MINGW_SPECIAL = "mingw "; //$NON-NLS-1$
|
||||||
private static final String CYGWIN_SPECIAL = "cygwin "; //$NON-NLS-1$
|
private static final String CYGWIN_SPECIAL = "cygwin "; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String ENV_PATH = "PATH"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
private static String envPathValueCached = null;
|
private static String envPathValueCached = null;
|
||||||
private static String envCygwinHomeValueCached = null;
|
|
||||||
private static String binCygwin = null;
|
private static String binCygwin = null;
|
||||||
private static String rootCygwin = null;
|
private static String rootCygwin = null;
|
||||||
private static String etcCygwin = null;
|
private static String etcCygwin = null;
|
||||||
|
@ -95,40 +90,40 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return "/etc" path in Windows format.
|
* returns "/etc" path in Windows format
|
||||||
*
|
*
|
||||||
* If you use this do not cache results to ensure user preferences are accounted for.
|
* If you use this do not cache results to ensure user preferences are accounted for.
|
||||||
* Please rely on internal caching.
|
* Please rely on internal caching.
|
||||||
*/
|
*/
|
||||||
public static String getEtcPath() {
|
public static String getEtcPath() {
|
||||||
locateCygwin();
|
findPaths();
|
||||||
return etcCygwin;
|
return etcCygwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return "/usr/bin" path in Windows format.
|
* returns "/usr/bin" path in Windows format
|
||||||
*
|
*
|
||||||
* If you use this do not cache results to ensure user preferences are accounted for.
|
* If you use this do not cache results to ensure user preferences are accounted for.
|
||||||
* Please rely on internal caching.
|
* Please rely on internal caching.
|
||||||
*/
|
*/
|
||||||
public static String getBinPath() {
|
public static String getBinPath() {
|
||||||
locateCygwin();
|
findPaths();
|
||||||
return binCygwin;
|
return binCygwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Cygwin root ("/") path in Windows format.
|
* returns Cygwin root ("/") path in Windows format
|
||||||
*
|
*
|
||||||
* If you use this do not cache results to ensure user preferences are accounted for.
|
* If you use this do not cache results to ensure user preferences are accounted for.
|
||||||
* Please rely on internal caching.
|
* Please rely on internal caching.
|
||||||
*/
|
*/
|
||||||
public static String getRootPath() {
|
public static String getRootPath() {
|
||||||
locateCygwin();
|
findPaths();
|
||||||
return rootCygwin;
|
return rootCygwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWindows() {
|
public static boolean isWindows() {
|
||||||
return (System.getProperty(PROPERTY_OS_NAME).toLowerCase().startsWith(OS_WINDOWS));
|
return (System.getProperty(PROPERTY_OS_NAME).toLowerCase().startsWith(PROPERTY_OS_VALUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,63 +148,55 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the absolute path of the pattern by simply appending the relativePath to the root.
|
* Returns the absolute path of the pattern by
|
||||||
|
* simply appending the pattern to the root
|
||||||
*
|
*
|
||||||
* @param relativePath - the pattern to find.
|
* @param pattern The pattern to find
|
||||||
* @return The absolute path to the pattern or {@code null} if path does not exist.
|
* @return The absolute path to the pattern or null if pattern is not found
|
||||||
*/
|
*/
|
||||||
private static String getPathFromRoot(String relativePath) {
|
private static String getValueFromRoot(String pattern) {
|
||||||
if (rootCygwin != null) {
|
if (rootCygwin != null) {
|
||||||
String path = rootCygwin + relativePath;
|
String path = rootCygwin + pattern;
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
if (file.exists() && file.isDirectory()) {
|
if (file.exists() && file.isDirectory())
|
||||||
return (path.replaceAll(BSLASH, SSLASH));
|
return (path.replaceAll(BSLASH, SSLASH));
|
||||||
}
|
else
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns the absolute path to cygwin's root
|
||||||
|
*
|
||||||
* @return The absolute path to cygwin's root or null if not found
|
* @return The absolute path to cygwin's root or null if not found
|
||||||
*/
|
*/
|
||||||
private static String findRoot(String paths) {
|
private static String findRoot(String paths) {
|
||||||
String rootValue = null;
|
String rootValue = null;
|
||||||
|
|
||||||
// Check $CYGWIN_HOME
|
// 1. Look in PATH values. Look for bin\cygwin1.dll
|
||||||
if (envCygwinHomeValueCached != null && !envCygwinHomeValueCached.isEmpty()) {
|
IPath location = PathUtil.findProgramLocation("cygwin1.dll", paths); //$NON-NLS-1$
|
||||||
IPath location = new Path(envCygwinHomeValueCached + "/bin/" + CYGWIN_DLL);
|
if (location!=null) {
|
||||||
if (location.toFile().exists()) {
|
rootValue = location.removeLastSegments(2).toOSString();
|
||||||
// deduct rootValue from "rootValue\bin\cygwin1.dll"
|
|
||||||
rootValue = location.removeLastSegments(2).toOSString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look in PATH values. Look for cygwin1.dll
|
// 2. Try to find the root dir in SOFTWARE\Cygwin\setup
|
||||||
if(rootValue == null) {
|
|
||||||
IPath location = PathUtil.findProgramLocation(CYGWIN_DLL, paths);
|
|
||||||
if (location != null) {
|
|
||||||
// deduct rootValue from "rootValue\bin\cygwin1.dll"
|
|
||||||
rootValue = location.removeLastSegments(2).toOSString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to find the root dir in SOFTWARE\Cygwin\setup
|
|
||||||
if(rootValue == null) {
|
if(rootValue == null) {
|
||||||
rootValue = readValueFromRegistry(REGISTRY_KEY_SETUP, "rootdir"); //$NON-NLS-1$
|
rootValue = readValueFromRegistry(REGISTRY_KEY_SETUP, "rootdir"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to find the root dir in SOFTWARE\Wow6432Node\Cygwin\setup
|
// 3. Try to find the root dir in SOFTWARE\Wow6432Node\Cygwin\setup
|
||||||
if(rootValue == null) {
|
if(rootValue == null) {
|
||||||
rootValue = readValueFromRegistry(REGISTRY_KEY_SETUP_WIN64, "rootdir"); //$NON-NLS-1$
|
rootValue = readValueFromRegistry(REGISTRY_KEY_SETUP_WIN64, "rootdir"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to find the root dir in SOFTWARE\Cygnus Solutions
|
// 4. Try to find the root dir in SOFTWARE\Cygnus Solutions
|
||||||
if (rootValue == null) {
|
if (rootValue == null) {
|
||||||
rootValue = readValueFromRegistry(REGISTRY_KEY_MOUNTS + ROOTPATTERN, PATH_NAME);
|
rootValue = readValueFromRegistry(REGISTRY_KEY_MOUNTS + ROOTPATTERN, PATH_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try the default Cygwin install dir
|
// 5. Try the default Cygwin install dir
|
||||||
if(rootValue == null) {
|
if(rootValue == null) {
|
||||||
File file = new File(DEFAULT_ROOT);
|
File file = new File(DEFAULT_ROOT);
|
||||||
if (file.exists() && file.isDirectory())
|
if (file.exists() && file.isDirectory())
|
||||||
|
@ -225,36 +212,31 @@ public class CygwinPathResolver implements IBuildPathResolver {
|
||||||
/**
|
/**
|
||||||
* Finds Cygwin's paths and sets corresponding properties.
|
* Finds Cygwin's paths and sets corresponding properties.
|
||||||
*/
|
*/
|
||||||
private static synchronized void locateCygwin() {
|
private static synchronized void findPaths() {
|
||||||
if (!isWindows()) {
|
if (!isWindows()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_PATH, null, true);
|
IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable("PATH", null, true); //$NON-NLS-1$
|
||||||
String envPathValue = varPath != null ? varPath.getValue() : null;
|
String envPathValue = varPath != null ? varPath.getValue() : null;
|
||||||
IEnvironmentVariable varCygwinHome = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable("CYGWIN_HOME", null, true); //$NON-NLS-1$
|
|
||||||
String envCygwinHomeValue = varCygwinHome != null ? varCygwinHome.getValue() : null;
|
|
||||||
|
|
||||||
if (CDataUtil.objectsEqual(envPathValue, envPathValueCached) && CDataUtil.objectsEqual(envCygwinHomeValue, envCygwinHomeValueCached)) {
|
if (CDataUtil.objectsEqual(envPathValue, envPathValueCached)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
envPathValueCached = envPathValue;
|
|
||||||
envCygwinHomeValueCached = envCygwinHomeValue;
|
|
||||||
|
|
||||||
etcCygwin = null;
|
etcCygwin = null;
|
||||||
binCygwin = null;
|
binCygwin = null;
|
||||||
rootCygwin = null;
|
rootCygwin = null;
|
||||||
|
|
||||||
rootCygwin = findRoot(envPathValue);
|
rootCygwin = findRoot(envPathValue);
|
||||||
|
|
||||||
// Try to find the paths by appending the patterns to the root dir
|
// 1. Try to find the paths by appending the patterns to the root dir
|
||||||
etcCygwin = getPathFromRoot(ETCPATTERN);
|
etcCygwin = getValueFromRoot(ETCPATTERN);
|
||||||
binCygwin = getPathFromRoot(BINPATTERN);
|
binCygwin = getValueFromRoot(BINPATTERN);
|
||||||
if(binCygwin == null)
|
if(binCygwin == null)
|
||||||
binCygwin = getPathFromRoot(BINPATTERN_ALTERNATE);
|
binCygwin = getValueFromRoot(BINPATTERN_ALTERNATE);
|
||||||
|
|
||||||
// Try to find the paths in SOFTWARE\\Cygnus Solutions
|
// 2. Try to find the paths in SOFTWARE\\Cygnus Solutions
|
||||||
if(etcCygwin == null)
|
if(etcCygwin == null)
|
||||||
etcCygwin = readValueFromRegistry(REGISTRY_KEY_MOUNTS + ETCPATTERN, PATH_NAME);
|
etcCygwin = readValueFromRegistry(REGISTRY_KEY_MOUNTS + ETCPATTERN, PATH_NAME);
|
||||||
if(binCygwin == null)
|
if(binCygwin == null)
|
||||||
|
|
|
@ -15,22 +15,20 @@ import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
|
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
|
import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*/
|
*/
|
||||||
public class GnuCygwinConfigurationEnvironmentSupplier implements IConfigurationEnvironmentVariableSupplier {
|
public class GnuCygwinConfigurationEnvironmentSupplier implements IConfigurationEnvironmentVariableSupplier {
|
||||||
private static final String ENV_PATH = "PATH"; //$NON-NLS-1$
|
private static final String PATH = "PATH"; //$NON-NLS-1$
|
||||||
private static final String ENV_CYGWIN_HOME = "CYGWIN_HOME"; //$NON-NLS-1$
|
|
||||||
private static final String ENV_LANG = "LANG"; //$NON-NLS-1$
|
|
||||||
private static final String ENV_LC_ALL = "LC_ALL"; //$NON-NLS-1$
|
|
||||||
private static final String ENV_LC_MESSAGES = "LC_MESSAGES"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$
|
private static final String DELIMITER_UNIX = ":"; //$NON-NLS-1$
|
||||||
private static final String PROPERTY_DELIMITER = "path.separator"; //$NON-NLS-1$
|
private static final String PROPERTY_DELIMITER = "path.separator"; //$NON-NLS-1$
|
||||||
private static final String PROPERTY_OSNAME = "os.name"; //$NON-NLS-1$
|
private static final String PROPERTY_OSNAME = "os.name"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String LANG = "LANG"; //$NON-NLS-1$
|
||||||
|
private static final String LC_ALL = "LC_ALL"; //$NON-NLS-1$
|
||||||
|
private static final String LC_MESSAGES = "LC_MESSAGES"; //$NON-NLS-1$
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||||
if (variableName == null) {
|
if (variableName == null) {
|
||||||
|
@ -41,28 +39,19 @@ public class GnuCygwinConfigurationEnvironmentSupplier implements IConfiguration
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variableName.equalsIgnoreCase(ENV_PATH)) {
|
if (variableName.equalsIgnoreCase(PATH)) {
|
||||||
String path = CygwinPathResolver.getBinPath();
|
String p = CygwinPathResolver.getBinPath();
|
||||||
if (path != null) {
|
if (p != null) {
|
||||||
path = new Path(path).toOSString();
|
return new BuildEnvVar(PATH, p.replace('/','\\'), IBuildEnvironmentVariable.ENVVAR_PREPEND, System.getProperty(PROPERTY_DELIMITER, DELIMITER_UNIX));
|
||||||
return new BuildEnvVar(ENV_PATH, path, IBuildEnvironmentVariable.ENVVAR_PREPEND, System.getProperty(PROPERTY_DELIMITER, DELIMITER_UNIX));
|
|
||||||
}
|
}
|
||||||
} else if (variableName.equals(ENV_CYGWIN_HOME)) {
|
} else if (variableName.equalsIgnoreCase(LANG)) {
|
||||||
String home = CygwinPathResolver.getRootPath();
|
|
||||||
if (home == null) {
|
|
||||||
home = ""; //$NON-NLS-1$
|
|
||||||
} else {
|
|
||||||
home = new Path(home).toOSString();
|
|
||||||
}
|
|
||||||
return new BuildEnvVar(ENV_CYGWIN_HOME, home);
|
|
||||||
} else if (variableName.equalsIgnoreCase(ENV_LANG)) {
|
|
||||||
// Workaround for not being able to select encoding for CDT console -> change codeset to Latin1
|
// Workaround for not being able to select encoding for CDT console -> change codeset to Latin1
|
||||||
String langValue = System.getenv(ENV_LANG);
|
String langValue = System.getenv(LANG);
|
||||||
if (langValue == null || langValue.length() == 0) {
|
if (langValue == null || langValue.length() == 0) {
|
||||||
langValue = System.getenv(ENV_LC_ALL);
|
langValue = System.getenv(LC_ALL);
|
||||||
}
|
}
|
||||||
if (langValue == null || langValue.length() == 0) {
|
if (langValue == null || langValue.length() == 0) {
|
||||||
langValue = System.getenv(ENV_LC_MESSAGES);
|
langValue = System.getenv(LC_MESSAGES);
|
||||||
}
|
}
|
||||||
if (langValue != null && langValue.length() > 0) {
|
if (langValue != null && langValue.length() > 0) {
|
||||||
// langValue is [language[_territory][.codeset][@modifier]], i.e. "en_US.UTF-8@dict"
|
// langValue is [language[_territory][.codeset][@modifier]], i.e. "en_US.UTF-8@dict"
|
||||||
|
@ -73,21 +62,20 @@ public class GnuCygwinConfigurationEnvironmentSupplier implements IConfiguration
|
||||||
langValue = "C.ISO-8859-1"; //$NON-NLS-1$
|
langValue = "C.ISO-8859-1"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BuildEnvVar(ENV_LANG, langValue);
|
return new BuildEnvVar(LANG, langValue);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||||
IBuildEnvironmentVariable varHome = getVariable(ENV_CYGWIN_HOME, configuration, provider);
|
IBuildEnvironmentVariable varLang = getVariable(LANG, configuration, provider);
|
||||||
IBuildEnvironmentVariable varLang = getVariable(ENV_LANG, configuration, provider);
|
IBuildEnvironmentVariable varPath = getVariable(PATH, configuration, provider);
|
||||||
IBuildEnvironmentVariable varPath = getVariable(ENV_PATH, configuration, provider);
|
|
||||||
|
|
||||||
if (varPath != null) {
|
if (varPath != null) {
|
||||||
return new IBuildEnvironmentVariable[] {varHome, varLang, varPath};
|
return new IBuildEnvironmentVariable[] {varLang, varPath};
|
||||||
} else {
|
} else {
|
||||||
return new IBuildEnvironmentVariable[] {varHome, varLang};
|
return new IBuildEnvironmentVariable[] {varLang};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.eclipse.core.runtime.Platform;
|
||||||
* @noextend This class is not intended to be subclassed by clients.
|
* @noextend This class is not intended to be subclassed by clients.
|
||||||
*/
|
*/
|
||||||
public class MingwEnvironmentVariableSupplier implements IConfigurationEnvironmentVariableSupplier {
|
public class MingwEnvironmentVariableSupplier implements IConfigurationEnvironmentVariableSupplier {
|
||||||
private static final String ENV_MINGW_HOME = "MINGW_HOME"; //$NON-NLS-1$
|
|
||||||
private static final String ENV_PATH = "PATH"; //$NON-NLS-1$
|
private static final String ENV_PATH = "PATH"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static String envPathValueCached = null;
|
private static String envPathValueCached = null;
|
||||||
|
@ -99,7 +98,7 @@ public class MingwEnvironmentVariableSupplier implements IConfigurationEnvironme
|
||||||
private static void locateMingw() {
|
private static void locateMingw() {
|
||||||
IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_PATH, null, true);
|
IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_PATH, null, true);
|
||||||
String envPathValue = varPath != null ? varPath.getValue() : null;
|
String envPathValue = varPath != null ? varPath.getValue() : null;
|
||||||
IEnvironmentVariable varMingwHome = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_MINGW_HOME, null, true);
|
IEnvironmentVariable varMingwHome = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable("MINGW_HOME", null, true); //$NON-NLS-1$
|
||||||
String envMingwHomeValue = varMingwHome != null ? varMingwHome.getValue() : null;
|
String envMingwHomeValue = varMingwHome != null ? varMingwHome.getValue() : null;
|
||||||
|
|
||||||
if (CDataUtil.objectsEqual(envPathValue, envPathValueCached) && CDataUtil.objectsEqual(envMingwHomeValue, envMingwHomeValueCached)) {
|
if (CDataUtil.objectsEqual(envPathValue, envPathValueCached) && CDataUtil.objectsEqual(envMingwHomeValue, envMingwHomeValueCached)) {
|
||||||
|
@ -182,18 +181,7 @@ public class MingwEnvironmentVariableSupplier implements IConfigurationEnvironme
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||||
if (variableName.equals(ENV_MINGW_HOME)) {
|
if (variableName.equals(ENV_PATH)) {
|
||||||
locateMingw();
|
|
||||||
String home = envMingwHomeValueCached;
|
|
||||||
if (home == null) {
|
|
||||||
if (binDir != null) {
|
|
||||||
home = binDir.removeLastSegments(1).toOSString();
|
|
||||||
} else {
|
|
||||||
home = ""; //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new MingwBuildEnvironmentVariable(ENV_MINGW_HOME, home, IBuildEnvironmentVariable.ENVVAR_REPLACE);
|
|
||||||
} else if (variableName.equals(ENV_PATH)) {
|
|
||||||
locateMingw();
|
locateMingw();
|
||||||
if (binDir != null) {
|
if (binDir != null) {
|
||||||
String pathStr = binDir.toOSString();
|
String pathStr = binDir.toOSString();
|
||||||
|
@ -209,11 +197,10 @@ public class MingwEnvironmentVariableSupplier implements IConfigurationEnvironme
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||||
IBuildEnvironmentVariable home = getVariable(ENV_MINGW_HOME, configuration, provider);
|
|
||||||
IBuildEnvironmentVariable path = getVariable(ENV_PATH, configuration, provider);
|
IBuildEnvironmentVariable path = getVariable(ENV_PATH, configuration, provider);
|
||||||
return path != null
|
return path != null
|
||||||
? new IBuildEnvironmentVariable[] { home, path }
|
? new IBuildEnvironmentVariable[] { path }
|
||||||
: new IBuildEnvironmentVariable[] { home };
|
: new IBuildEnvironmentVariable[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue