VirtualFile is not refreshed
Answered
I have been implementing copy/paste clipboard feature over some kind of node that contains virtualFile field. The problem is when I try to paste a copy, I need to copy file content as well, but for a some reason it caches the old file content.
The files are changed via Editor.
No one way I found to refresh the virtual files does not work:
LocalFileSystem.getInstance().refreshFiles(listOf(virtualFile), false, false)
//or
virtualFile.refresh(false , false)
These files are created out of Project the following way:
val file = File("${pluginDir.path}${fileSeparator}${node.id}.${extension}")
if (!file.exists()) {
file.createNewFile()
}
return LocalFileSystem.getInstance().findFileByNioFile(
file.toPath()
)
Could you please help, should I refresh it somehow else or the issue is in wrong VirtualFile creation?
Please sign in to leave a comment.
found the working way to read actual data:
also:
That is the answer,thank you, brother