Commit 401bd5c6 authored by Vadim Salavatov's avatar Vadim Salavatov Committed by intellij-monorepo-bot
Browse files

(241 adjusted) IDEA-349639 filter out certainly unrelated MacOS crash reports in a diagnostic zip

(cherry picked from commit 37561d4e7b685818e2bcb0e7ec96381a4e4cc1ae)

IJ-MR-129405

GitOrigin-RevId: 4ebe4902870c7e7b57f69514bb59e76f9d8a1bd1
parent e4125841
Branches unavailable Tags unavailable
No related merge requests found
Showing with 11 additions and 1 deletion
+11 -1
......@@ -111,7 +111,7 @@ object LogsPacker {
for (path in paths) {
coroutineContext.ensureActive()
val name = path.fileName.toString()
if (name.endsWith(".ips") && Files.isRegularFile(path)) {
if (name.endsWith(".ips") && Files.isRegularFile(path) && doesMacOSDiagnosticReportBelongToThisApp(path)) {
zip.addFile("MacOS_DiagnosticReports/$name", path.readBytes())
}
}
......@@ -215,4 +215,14 @@ object LogsPacker {
private fun buildEntryName(prefix: String?, file: Path): String {
return if (!prefix.isNullOrEmpty()) "$prefix/${file.name}" else ""
}
private fun doesMacOSDiagnosticReportBelongToThisApp(path: Path): Boolean {
val name = path.name
if (name.contains(ApplicationNamesInfo.getInstance().scriptName, ignoreCase = true)) return true
if (name.contains("java", ignoreCase = true)) {
// if IDE is run from sources
return Files.readString(path).contains("jetbrains", ignoreCase = true)
}
return false
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment