From 6498d38ed63aa686659cc5a79cd4e39a61b82bc8 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Wed, 29 Sep 2010 23:19:33 +0000 Subject: [PATCH] bug 308042: Spawner messages are too cryptic to be useful to a user --- .../utils/org/eclipse/cdt/utils/PathUtil.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/PathUtil.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/PathUtil.java index 7af084a2bc3..751aab62b8e 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/PathUtil.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/PathUtil.java @@ -282,11 +282,18 @@ public class PathUtil { * can be omitted. * @param pathsStr - the list of paths to inspect separated by path separator * defined in the platform (i.e. ":" in Unix and ";" in Windows). + * In case pathStr is {@code null} environment variable ${PATH} is inspected. * @return - absolute location of the file on the file system. * @since 5.3 */ public static IPath findProgramLocation(String prog, String pathsStr) { - if (prog.trim().length()==0 || pathsStr.trim().length()==0) + if (prog==null || prog.trim().length()==0) + return null; + + if (pathsStr==null) + pathsStr = System.getenv("PATH"); //$NON-NLS-1$ + + if (pathsStr.trim().length()==0) return null; String locationStr = null; @@ -342,7 +349,6 @@ public class PathUtil { * @since 5.3 */ public static IPath findProgramLocation(String prog) { - String pathVariable = System.getenv("PATH"); //$NON-NLS-1$ - return findProgramLocation(prog, pathVariable); + return findProgramLocation(prog, null); } }