boolean (String moduleName, String skeletonDir) { File targetDir; final String modulePath = moduleName.replace('.', '/'); File skeletonsDir = new File(skeletonDir); VirtualFile pregenerated = myArchiveRoot.findFileByRelativePath(modulePath + ".py"); if (pregenerated == null) { pregenerated = myArchiveRoot.findFileByRelativePath(modulePath + "/" + PyNames.INIT_DOT_PY); targetDir = new File(skeletonsDir, modulePath); } else { int pos = modulePath.lastIndexOf('/'); if (pos < 0) { targetDir = skeletonsDir; } else { final String moduleParentPath = modulePath.substring(0, pos); targetDir = new File(skeletonsDir, moduleParentPath); } } if (pregenerated != null && (targetDir.exists() || targetDir.mkdirs())) { LOG.info("Pre-generated skeleton for " + moduleName); File target = new File(targetDir, pregenerated.getName()); try (FileOutputStream fos = new FileOutputStream(target)) { FileUtil.copy(pregenerated.getInputStream(), fos); } catch (IOException e) { LOG.info("Error copying pre-generated skeleton", e); return false; } return true; } return false; }