Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2007-02-22 20:51:27 +0000
committerDoug Schaefer2007-02-22 20:51:27 +0000
commit049d28c3fe6d0df26d5fc5d4fba574f1f8c3c82a (patch)
tree790689323a8d7ccd3a8178e33db2f0d8f387871a /build/org.eclipse.cdt.managedbuilder.gnu.ui/src
parentd811dbadb353f1e984a518563a9203fbe9c46355 (diff)
downloadorg.eclipse.cdt-049d28c3fe6d0df26d5fc5d4fba574f1f8c3c82a.tar.gz
org.eclipse.cdt-049d28c3fe6d0df26d5fc5d4fba574f1f8c3c82a.tar.xz
org.eclipse.cdt-049d28c3fe6d0df26d5fc5d4fba574f1f8c3c82a.zip
Removed hardcoding of MinGW location.
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.java23
1 files changed, 17 insertions, 6 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 ce0cd9ff9e8..e04899b9a4e 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
@@ -11,6 +11,8 @@
package org.eclipse.cdt.managedbuilder.gnu.mingw;
+import java.io.File;
+
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
@@ -56,13 +58,22 @@ public class MingwEnvironmentVariableSupplier implements
private final IBuildEnvironmentVariable path;
public MingwEnvironmentVariableSupplier() {
- String bin = "C:/MinGW/bin";
+ // 1. Try the mingw directory in the platform install directory
+ String bin = Platform.getInstallLocation().getURL().getFile().substring(1) + "mingw/bin";
- // TODO try finding MinGW in either of:
- // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MinGW, InstallLocation
- // or using:
- // String bin = Platform.getInstallLocation().getURL().getFile().substring(1)
- // + "mingw/bin";
+ if (!new File(bin).exists()) {
+ // 2. Try looking if the mingw installer ran
+ bin = WindowsRegistry.getRegistry().getLocalMachineValue(
+ "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW",
+ "InstallLocation");
+ if (bin != null)
+ bin += "\\bin";
+
+ if (bin == null || !new File(bin).exists()) {
+ // 3. Try the standard location
+ bin = "C:/MinGW/bin";
+ }
+ }
path = new MingwBuildEnvironmentVariable(
"PATH",

Back to the top