diff options
| author | Ed Merks | 2020-09-01 10:12:38 +0000 |
|---|---|---|
| committer | Ed Merks | 2020-09-01 10:12:38 +0000 |
| commit | 26f77a49aaa35315430fa59153a8b0a7a107205a (patch) | |
| tree | 62b423128378e1c9d09b32cb92138893b40339c5 | |
| parent | 36145f24aa6b785517d9c4c780d4ad70a45fd14b (diff) | |
| download | org.eclipse.oomph-26f77a49aaa35315430fa59153a8b0a7a107205a.tar.gz org.eclipse.oomph-26f77a49aaa35315430fa59153a8b0a7a107205a.tar.xz org.eclipse.oomph-26f77a49aaa35315430fa59153a8b0a7a107205a.zip | |
[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
| -rw-r--r-- | plugins/org.eclipse.oomph.jreinfo/src/org/eclipse/oomph/jreinfo/JREManager.java | 21 |
1 files changed, 17 insertions, 4 deletions
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 bd3934c48..084c35932 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 @@ public final class JREManager { 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 @@ public final class JREManager } } + 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 @@ public final class JREManager return 32; } - private static String getInstallerLocation() + private static File getInstallerLocation() { try { @@ -559,7 +572,7 @@ public final class JREManager { result = result.appendSegment(""); //$NON-NLS-1$ } - return result.toFileString(); + return IOUtil.getCanonicalFile(new File(result.toFileString())); } } } |
