Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gvozdev2010-09-29 04:37:52 +0000
committerAndrew Gvozdev2010-09-29 04:37:52 +0000
commitc03b1c1796a2ee7e4d11d78dc7f371616e5566a1 (patch)
tree2c3224161aa98ec7a962c7028e8fc255f1a02e01 /build/org.eclipse.cdt.managedbuilder.gnu.ui/src
parentad14e006151997830c40cf26770bf04ceed99332 (diff)
downloadorg.eclipse.cdt-c03b1c1796a2ee7e4d11d78dc7f371616e5566a1.tar.gz
org.eclipse.cdt-c03b1c1796a2ee7e4d11d78dc7f371616e5566a1.tar.xz
org.eclipse.cdt-c03b1c1796a2ee7e4d11d78dc7f371616e5566a1.zip
bug 308042: Spawner messages are too cryptic to be useful to a user
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/cygwin/CygwinPathResolver.java20
-rw-r--r--build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/mingw/MingwEnvironmentVariableSupplier.java18
2 files changed, 10 insertions, 28 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/CygwinPathResolver.java b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/CygwinPathResolver.java
index c866414fcf1..4d97d2ac5a0 100644
--- a/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/CygwinPathResolver.java
+++ b/build/org.eclipse.cdt.managedbuilder.gnu.ui/src/org/eclipse/cdt/managedbuilder/gnu/cygwin/CygwinPathResolver.java
@@ -24,9 +24,10 @@ import org.eclipse.cdt.managedbuilder.core.IBuildPathResolver;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.gnu.ui.GnuUIPlugin;
+import org.eclipse.cdt.utils.PathUtil;
import org.eclipse.cdt.utils.WindowsRegistry;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
-import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.IPath;
/**
@@ -167,20 +168,11 @@ public class CygwinPathResolver implements IBuildPathResolver {
String rootValue = null;
// 1. Look in PATH values. Look for bin\cygwin1.dll
- String pathVariable = System.getenv("PATH"); //$NON-NLS-1$
- String[] paths = pathVariable.split(";"); //$NON-NLS-1$
- for (String pathStr : paths) {
- // If there is a trailing / or \, remove it
- if ((pathStr.endsWith("\\") || pathStr.endsWith("/")) && pathStr.length() > 1) //$NON-NLS-1$ //$NON-NLS-2$
- pathStr = pathStr.substring(0, pathStr.length() - 1);
-
- Path pathFile = new Path(pathStr + "\\cygwin1.dll"); //$NON-NLS-1$
- if (pathFile.toFile().exists()) {
- rootValue = pathFile.removeLastSegments(2).toOSString();
- break;
- }
+ IPath location = PathUtil.findProgramLocation("cygwin1.dll"); //$NON-NLS-1$
+ if (location!=null) {
+ rootValue = location.removeLastSegments(2).toOSString();
}
-
+
// 2. Try to find the root dir in SOFTWARE\Cygwin\setup
if(rootValue == null) {
rootValue = readValueFromRegistry(REGISTRY_KEY_SETUP, "rootdir"); //$NON-NLS-1$
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 c42d1100706..ad7dd6ebb0a 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,12 +11,11 @@
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;
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;
@@ -88,18 +87,9 @@ public class MingwEnvironmentVariableSupplier implements
// 3. Look in PATH values. Look for mingw32-gcc.exe
if (binDir == null) {
- String pathVariable = System.getenv("PATH"); //$NON-NLS-1$
- String[] paths = pathVariable.split(";"); //$NON-NLS-1$
- for (String pathStr : paths) {
- // If there is a trailing / or \, remove it
- if ((pathStr.endsWith("\\") || pathStr.endsWith("/")) && pathStr.length() > 1) //$NON-NLS-1$ //$NON-NLS-2$
- pathStr = pathStr.substring(0, pathStr.length() - 1);
-
- File pathFile = new File(pathStr + "\\mingw32-gcc.exe"); //$NON-NLS-1$
- if (pathFile.exists()) {
- binDir = new Path(pathStr);
- break;
- }
+ IPath location = PathUtil.findProgramLocation("mingw32-gcc.exe"); //$NON-NLS-1$
+ if (location!=null) {
+ binDir = location.removeLastSegments(1);
}
}

Back to the top