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))