diff --git a/core/driver/sources/src/main/scala/org/virtuslab/ideprobe/ide/intellij/InstalledIntelliJ.scala b/core/driver/sources/src/main/scala/org/virtuslab/ideprobe/ide/intellij/InstalledIntelliJ.scala index 0b1687fd..7d65afb7 100644 --- a/core/driver/sources/src/main/scala/org/virtuslab/ideprobe/ide/intellij/InstalledIntelliJ.scala +++ b/core/driver/sources/src/main/scala/org/virtuslab/ideprobe/ide/intellij/InstalledIntelliJ.scala @@ -227,7 +227,10 @@ final class DownloadedIntelliJ( probePaths.logExport.foreach { path => paths.logs.copyDir(path.resolve(getPathWithVersionNumber(root)).resolve("logs")) } - root.delete() + if (OS.Current == OS.Mac && root.name == "Contents") + root.getParent.delete() + else + root.delete() } /* diff --git a/core/driver/sources/src/test/scala/org/virtuslab/ideprobe/dependencies/SingleRunFixtureTest.scala b/core/driver/sources/src/test/scala/org/virtuslab/ideprobe/dependencies/SingleRunFixtureTest.scala index d419a709..bb85a3cc 100644 --- a/core/driver/sources/src/test/scala/org/virtuslab/ideprobe/dependencies/SingleRunFixtureTest.scala +++ b/core/driver/sources/src/test/scala/org/virtuslab/ideprobe/dependencies/SingleRunFixtureTest.scala @@ -56,8 +56,9 @@ final class SingleRunFixtureTest extends IdeProbeFixture with WorkspaceFixture w @Test def removesDirectoriesEvenAfterFailureToRunIntelliJ(): Unit = { + val intellijLauncher = if (OS.Current == OS.Mac) "idea" else "idea.sh" val intelliJFixture = IntelliJFixture().withAfterIntelliJInstall((_, intellij) => - Files.delete(intellij.paths.root.resolve("bin").resolve("idea.sh")) // To prevent the IDE from launching. + Files.delete(intellij.paths.root.resolve("bin").resolve(intellijLauncher)) // To prevent the IDE from launching. ) val instancesDir = intelliJFixture.intelliJProvider.paths.instances