diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index 7440fc9d1..ac8d65501 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -244,7 +244,20 @@ public String run() { return new File(home).getAbsoluteFile(); } + /** + * Searches the given path to see if it contains one of the given files. + * Returns the first it finds. Returns null if not found or if path is null. + * + * @param path + * List of paths to search separated by File.pathSeparator + * @param lookFor + * Files to search for in the given path + * @return the first match found, or null + **/ static File searchPath(final String path, final String... lookFor) { + if (path == null) + return null; + for (final String p : path.split(File.pathSeparator)) { for (String command : lookFor) { final File e = new File(p, command);