Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2011-01-05 18:30:02 +0000
committerDoug Schaefer2011-01-05 18:30:02 +0000
commit67cb94a1638e4b5b27e017ca2d88dc532dfdccf3 (patch)
tree395d5c3afff38824657605a87a70de3fa3d6e7c7 /build/org.eclipse.cdt.managedbuilder.gnu.ui/src
parente27e34dd13e0db9ab944a44c56c59c5d958fa1a1 (diff)
downloadorg.eclipse.cdt-67cb94a1638e4b5b27e017ca2d88dc532dfdccf3.tar.gz
org.eclipse.cdt-67cb94a1638e4b5b27e017ca2d88dc532dfdccf3.tar.xz
org.eclipse.cdt-67cb94a1638e4b5b27e017ca2d88dc532dfdccf3.zip
Bug 333587 - Update to handle new MinGW installer.
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.gnu.ui/src')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwEnvironmentVariableSupplier.java90
1 files changed, 42 insertions, 48 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwEnvironmentVariableSupplier.java b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwEnvironmentVariableSupplier.java
index ad7dd6ebb0a..43d8de12ccf 100644
--- a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwEnvironmentVariableSupplier.java
+++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwEnvironmentVariableSupplier.java
@@ -16,7 +16,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.utils.PathUtil;
-import org.eclipse.cdt.utils.WindowsRegistry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
@@ -63,66 +62,61 @@ public class MingwEnvironmentVariableSupplier implements
private IBuildEnvironmentVariable path;
public static IPath getBinDir() {
- if (!checked)
- findBinDir();
+ if (!checked) {
+ binDir = findBinDir();
+ checked = true;
+ }
return binDir;
}
- private static void findBinDir() {
- // 1. Try the mingw directory in the platform install directory
+ private static IPath findBinDir() {
+ // Try in MinGW home
+ String mingwHome = System.getenv("MINGW_HOME"); //$NON-NLS-1$
+ IPath mingwBinDir = new Path(mingwHome + "\\bin"); //$NON-NLS-1$
+ if (mingwBinDir.toFile().isDirectory())
+ return mingwBinDir;
+
+ // Try the mingw directory in the platform install directory
// CDT distributions like Wascana may distribute MinGW like that
- IPath subPath = new Path("mingw\\bin"); //$NON-NLS-1$
IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile());
- IPath binPathTemp = installPath.append(subPath);
- if (binPathTemp.toFile().isDirectory())
- binDir = binPathTemp;
-
- // 2. Try the directory above the install dir (another possible distribution)
- if (binDir == null) {
- binPathTemp = installPath.removeLastSegments(1).append(subPath);
- if (binPathTemp.toFile().isDirectory()) {
- binDir = binPathTemp;
- }
- }
-
- // 3. Look in PATH values. Look for mingw32-gcc.exe
- if (binDir == null) {
- IPath location = PathUtil.findProgramLocation("mingw32-gcc.exe"); //$NON-NLS-1$
- if (location!=null) {
- binDir = location.removeLastSegments(1);
- }
- }
-
- // 4. Try looking if the mingw installer ran
- if (binDir == null) {
- WindowsRegistry registry = WindowsRegistry.getRegistry();
- if (registry != null) {
- String mingwPath = registry.getLocalMachineValue(
- "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW", //$NON-NLS-1$
- "InstallLocation"); //$NON-NLS-1$
- if (mingwPath != null) {
- binPathTemp = new Path(mingwPath).append("bin"); //$NON-NLS-1$
- if (binPathTemp.toFile().isDirectory())
- binDir = binPathTemp;
- }
- }
- }
+ mingwBinDir = installPath.append("mingw\\bin"); //$NON-NLS-1$
+ if (mingwBinDir.toFile().isDirectory())
+ return mingwBinDir;
+
+ // Look in PATH values. Look for mingw32-gcc.exe
+ // TODO: Since this dir is already in the PATH, why are we adding it here?
+ // This is really only to support isToolchainAvail. Must be a better way.
+ IPath gccLoc = PathUtil.findProgramLocation("mingw32-gcc.exe"); //$NON-NLS-1$
+ if (gccLoc != null)
+ return gccLoc.removeLastSegments(1);
- // 5. Try the default MinGW install dir
- if (binDir == null) {
- binPathTemp = new Path("C:\\MinGW\\bin"); //$NON-NLS-1$
- if (binPathTemp.toFile().isDirectory())
- binDir = binPathTemp;
- }
+ // Try the default MinGW install dir
+ mingwBinDir = new Path("C:\\MinGW\\bin"); //$NON-NLS-1$
+ if (mingwBinDir.toFile().isDirectory())
+ return mingwBinDir;
- checked = true;
+ return null;
}
public static IPath getMsysBinDir() {
// Just look in the install location parent dir
IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile());
IPath msysBinPath = installPath.append("msys\\bin"); //$NON-NLS-1$
- return msysBinPath.toFile().isDirectory() ? msysBinPath : null;
+ if (msysBinPath.toFile().isDirectory())
+ return msysBinPath;
+
+ String mingwHome = System.getenv("MINGW_HOME"); //$NON-NLS-1$
+ if (mingwHome != null) {
+ msysBinPath = new Path(mingwHome + "\\msys\\1.0\\bin"); //$NON-NLS-1$
+ if (msysBinPath.toFile().isDirectory())
+ return msysBinPath;
+ }
+
+ // Try the new MinGW msys bin dir
+ msysBinPath = new Path("C:\\MinGW\\msys\\1.0\\bin"); //$NON-NLS-1$
+ if (msysBinPath.toFile().isDirectory())
+ return msysBinPath;
+ return null;
}
public MingwEnvironmentVariableSupplier() {

Back to the top