From f13e2dbba7701368c4565fa10588ed570feae2f2 Mon Sep 17 00:00:00 2001 From: Eugene Petrenko Date: Mon, 22 Mar 2021 14:34:34 +0100 Subject: [PATCH] runtime-chooser: XTEST-635 IDEA-264893 handle when "Contents" folder is selected for a JDK on macOS GitOrigin-RevId: 6906d1310925661e7fb95547101acedf2e37b491 --- .../projectRoots/impl/jdkDownloader/RuntimeChooserJre.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/jdkDownloader/RuntimeChooserJre.kt b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/jdkDownloader/RuntimeChooserJre.kt index 74181b9a6268..1473d2687983 100644 --- a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/jdkDownloader/RuntimeChooserJre.kt +++ b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/jdkDownloader/RuntimeChooserJre.kt @@ -68,10 +68,14 @@ object RuntimeChooserJreValidator { ?: return callback.onError( LangBundle.message("dialog.message.choose.ide.runtime.set.unknown.error", LangBundle.message("dialog.message.choose.ide.runtime.no.file.part"))) - if (SystemInfo.isMac && homeDir.endsWith("Contents/Home")) { + if (SystemInfo.isMac && homeDir.toString().endsWith("/Contents/Home")) { return testNewJdkUnderProgress(allowRunProcesses, { homeDir.parent?.parent?.toString() }, callback) } + if (SystemInfo.isMac && homeDir.fileName.toString() == "Contents" && (homeDir / "Home").isDirectory()) { + return testNewJdkUnderProgress(allowRunProcesses, { homeDir.parent?.toString() }, callback) + } + if (SystemInfo.isMac && !(homeDir / "Contents" / "Home").isDirectory()) { LOG.warn("Failed to scan JDK for boot runtime: ${homeDir}. macOS Bundle layout is expected") return callback.onError(LangBundle.message("dialog.message.choose.ide.runtime.set.error.mac.bundle", homeDir))