mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-14 03:35:37 +02:00
Removed hardcoding of MinGW location.
This commit is contained in:
parent
d811dbadb3
commit
049d28c3fe
1 changed files with 17 additions and 6 deletions
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.managedbuilder.gnu.mingw;
|
package org.eclipse.cdt.managedbuilder.gnu.mingw;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
|
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
|
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
|
||||||
|
@ -56,13 +58,22 @@ public class MingwEnvironmentVariableSupplier implements
|
||||||
private final IBuildEnvironmentVariable path;
|
private final IBuildEnvironmentVariable path;
|
||||||
|
|
||||||
public MingwEnvironmentVariableSupplier() {
|
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:
|
if (!new File(bin).exists()) {
|
||||||
// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MinGW, InstallLocation
|
// 2. Try looking if the mingw installer ran
|
||||||
// or using:
|
bin = WindowsRegistry.getRegistry().getLocalMachineValue(
|
||||||
// String bin = Platform.getInstallLocation().getURL().getFile().substring(1)
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MinGW",
|
||||||
// + "mingw/bin";
|
"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 = new MingwBuildEnvironmentVariable(
|
||||||
"PATH",
|
"PATH",
|
||||||
|
|
Loading…
Add table
Reference in a new issue