Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IntelliJ cleanup logic for macOs #301

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Comment on lines +230 to +231
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we want to delete whole IntelliJ instance directory, not only Contents/ (which is a subdirectory)

else
root.delete()
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor

@PawelLipski PawelLipski Oct 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, what's the type of this idea file on Mac (type in the sense of e.g. file command?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me paste the output of the file command:

lkontowski@lkontowski-MacBook-Pro /Applications/IntelliJ IDEA CE.app/Contents/MacOS 
% file idea
idea: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64
- Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64
- Mach-O 64-bit executable arm64]
idea (for architecture x86_64):	Mach-O 64-bit executable x86_64
idea (for architecture arm64):	Mach-O 64-bit executable arm64

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay... so not a script (idea.sh), as on Linux

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is an objective c app that reads some stuff from plist, modifies vmoptions and starts IJ

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
Expand Down