mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 22:11:40 +07:00
KMT-1199 [compose resources] create the accessors' file in case it doesn't exist already
(cherry picked from commit 61a9e21dfafc83cbfe561ff691ff44045caf6ffc) IJ-CR-173052 GitOrigin-RevId: a11662926b387e5348bfc53f8b60a06fb8f7d159
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5dde42b63a
commit
9bcf4da444
@@ -8,6 +8,8 @@ import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.util.concurrency.annotations.RequiresWriteLock
|
||||
import java.nio.file.Path
|
||||
import java.util.*
|
||||
import kotlin.io.path.createFile
|
||||
import kotlin.io.path.exists
|
||||
import kotlin.io.path.invariantSeparatorsPathString
|
||||
|
||||
private const val ITEMS_PER_FILE_LIMIT = 100
|
||||
@@ -111,6 +113,7 @@ private suspend fun getChunkFileSpec(
|
||||
@RequiresWriteLock
|
||||
private suspend fun writeAccessors(moduleDir: String, fileName: String, content: String): Unit = writeAction {
|
||||
val path = Path.of(moduleDir, fileName)
|
||||
if (!path.exists()) path.createFile()
|
||||
val documentManager = FileDocumentManager.getInstance()
|
||||
val document = path.toVirtualFile()?.let { virtualFile -> documentManager.getDocument(virtualFile) } ?: return@writeAction
|
||||
runUndoTransparentWriteAction { document.setText(content) }
|
||||
|
||||
Reference in New Issue
Block a user