VirtualFile (final VirtualFile dir, String content) { VirtualFile f = dir.findChild("profiles.xml"); if (f == null) { try { f = WriteAction.computeAndWait(() -> dir.createChildData(null, "profiles.xml")); } catch (IOException e) { throw new RuntimeException(e); } } setFileContent(f, content, true); return f; }