From f7d8b0cc8889e2bbb707630fe71fc8448f38b31d Mon Sep 17 00:00:00 2001 From: Nikolay Chashnikov Date: Mon, 23 Jun 2025 11:53:24 +0200 Subject: [PATCH] [remote dev] config share: fix sharing config between different frontend processes on macOS (IJPL-192726) It appears that on macOS only an 'ENTRY_CREATE' event is fired when a new file is created and some content is written to it (on Windows and Linux both 'ENTRY_CREATE' and 'ENTRY_MODIFY' are fired). GitOrigin-RevId: 288b763f1d01c785af5934a3dc27dd4d9d4bda4e --- .../shared/SharedConfigFolderNioListener.kt | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/shared/SharedConfigFolderNioListener.kt b/platform/platform-impl/src/com/intellij/openapi/project/impl/shared/SharedConfigFolderNioListener.kt index 170879da47e1..0407916cfdbc 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/shared/SharedConfigFolderNioListener.kt +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/shared/SharedConfigFolderNioListener.kt @@ -76,20 +76,22 @@ internal class SharedConfigFolderNioListener(private val root: Path, private val val fileSpec = getSpecFor(eventPath) if (fileSpec != null) { - if (kind == StandardWatchEventKinds.ENTRY_DELETE) { - if (!configFilesUpdatedByThisProcess.wasDeleted(fileSpec)) { - deleted.add(fileSpec) + when (kind) { + StandardWatchEventKinds.ENTRY_DELETE -> { + if (!configFilesUpdatedByThisProcess.wasDeleted(fileSpec)) { + deleted.add(fileSpec) + } + else { + LOG.trace { "skipped deleted file $fileName because it was deleted by this process" } + } } - else { - LOG.trace { "skipped deleted file $fileName because it was deleted by this process" } - } - } - else if (kind == StandardWatchEventKinds.ENTRY_MODIFY) { - if (!configFilesUpdatedByThisProcess.wasWritten(fileSpec, eventPath)) { - modified.add(fileSpec) - } - else { - LOG.trace { "skipped modified file $fileName because it was written by this process" } + StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_CREATE -> { + if (!configFilesUpdatedByThisProcess.wasWritten(fileSpec, eventPath)) { + modified.add(fileSpec) + } + else { + LOG.trace { "skipped modified file $fileName because it was written by this process" } + } } } }