[566450] Should we post the Eclipse Installer that include a JRE on our
download page by default?

https://bugs.eclipse.org/bugs/show_bug.cgi?id=566450
diff --git a/plugins/org.eclipse.oomph.jreinfo/src/org/eclipse/oomph/jreinfo/JREManager.java b/plugins/org.eclipse.oomph.jreinfo/src/org/eclipse/oomph/jreinfo/JREManager.java
index bd3934c..084c359 100644
--- a/plugins/org.eclipse.oomph.jreinfo/src/org/eclipse/oomph/jreinfo/JREManager.java
+++ b/plugins/org.eclipse.oomph.jreinfo/src/org/eclipse/oomph/jreinfo/JREManager.java
@@ -391,12 +391,12 @@
   {
     javaHomes.clear();
 
-    String installerLocation = getInstallerLocation();
+    File installerLocation = getInstallerLocation();
     JREInfo info = JREInfo.getAll();
     while (info != null)
     {
       // Ignore the JRE that is embedded in the installation itself.
-      if (installerLocation == null || !info.javaHome.startsWith(installerLocation))
+      if (installerLocation == null || !isAncestor(installerLocation, new File(info.javaHome)))
       {
         javaHomes.add(info.javaHome);
       }
@@ -405,6 +405,19 @@
     }
   }
 
+  private boolean isAncestor(File parent, File child)
+  {
+    for (File file = IOUtil.getCanonicalFile(child); file != null; file = file.getParentFile())
+    {
+      if (parent.equals(file))
+      {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
   private static List<String> loadExtraJavaHomes()
   {
     if (getCacheFile().isFile())
@@ -542,7 +555,7 @@
     return 32;
   }
 
-  private static String getInstallerLocation()
+  private static File getInstallerLocation()
   {
     try
     {
@@ -559,7 +572,7 @@
             {
               result = result.appendSegment(""); //$NON-NLS-1$
             }
-            return result.toFileString();
+            return IOUtil.getCanonicalFile(new File(result.toFileString()));
           }
         }
       }