private static void makeAndAddLibraryJar( final VirtualFile virtualFile, final File zipFile, final String pluginName, final ZipOutputStream zos, final Set<String> usedJarNames, final ProgressIndicator progressIndicator, final String preferredName) throws IOException { File libraryJar = FileUtil.createTempFile(TEMP_PREFIX, JAR_EXTENSION); libraryJar.deleteOnExit(); ZipOutputStream jar = null; try { jar = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(libraryJar))); ZipUtil.addFileOrDirRecursively( jar, libraryJar, VfsUtilCore.virtualToIoFile(virtualFile), "", createFilter(progressIndicator, FileTypeManager.getInstance()), null); } finally { if (jar != null) jar.close(); } final String jarName = getLibraryJarName( virtualFile.getName() + JAR_EXTENSION, usedJarNames, preferredName == null ? null : preferredName + JAR_EXTENSION); ZipUtil.addFileOrDirRecursively( zos, zipFile, libraryJar, getZipPath(pluginName, jarName), createFilter(progressIndicator, null), null); }
private static void addLibraryJar( final VirtualFile virtualFile, final File zipFile, final String pluginName, final ZipOutputStream zos, final Set<String> usedJarNames, final ProgressIndicator progressIndicator) throws IOException { File ioFile = VfsUtil.virtualToIoFile(virtualFile); final String jarName = getLibraryJarName(ioFile.getName(), usedJarNames, null); ZipUtil.addFileOrDirRecursively( zos, zipFile, ioFile, getZipPath(pluginName, jarName), createFilter(progressIndicator, null), null); }