VirtualFile (@NotNull String dataDir, @NotNull String targetDir, @NotNull VirtualFileFilter filter) { createTempDirectory(); return WriteAction.computeAndWait(() -> { try { VirtualFile tempDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(myTempDir.toString()); assertNotNull(tempDir); if (!targetDir.isEmpty()) { tempDir = VfsUtil.createDirectoryIfMissing(tempDir, targetDir.replace('\\', '/')); } VirtualFile from = LocalFileSystem.getInstance().refreshAndFindFileByPath(dataDir); assertNotNull(dataDir + " not found", from); VfsUtil.copyDirectory(null, from, tempDir, filter); return tempDir; } catch (IOException e) { throw new RuntimeException(e); } }); }