I am trying to create a file by psiFileFactory:
val project = e.getData(PlatformDataKeys.PROJECT)
var psiFileFactory = PsiFileFactory.getInstance(project)
val createFileFromText = psiFileFactory.createFileFromText("soc.md", "fadsfdsaf")
var directory = modFile.containingDirectory
But it could generate error if there is the same file. So is there any way to delete the same name file before create?