private static Collection<String> list(final File dir) { if (dir == null) { return Collections.emptyList(); } final Collection<String> libs = new ArrayList<>(); final File[] files = dir.listFiles(); if (files == null) { return Collections.emptyList(); } for (final File file : files) { if (file.isDirectory()) { libs.addAll(list(file)); } else { libs.add(file.getAbsolutePath()); } } return libs; }
private static Collection<String> list(final File dir) { if (dir == null) { return Collections.emptyList(); } final Collection<String> libs = new ArrayList<String>(); final File[] files = dir.listFiles(); if (files == null) { return Collections.emptyList(); } for (final File file : files) { if (file.isDirectory()) { libs.addAll(list(file)); } else { libs.add(file.getAbsolutePath()); } } return libs; }
private static Collection<String> extract(final String zip) throws IOException { final File tmp = new File(SystemInstance.get().getBase().getDirectory(), ProvisioningResolver.TEMP_DIR); if (!tmp.exists()) { try { Files.mkdirs(tmp); } catch (final Files.FileRuntimeException fre) { // ignored } } final File zipFile = new File(zip); final File extracted = new File(tmp, zipFile.getName().replace(".zip", "")); if (extracted.exists()) { return list(extracted); } else { Files.mkdirs(extracted); } Zips.unzip(zipFile, extracted); return list(extracted); }
private static Collection<String> extract(final String zip) throws IOException { final File tmp = new File(SystemInstance.get().getBase().getDirectory(), TEMP_DIR); if (!tmp.exists()) { try { Files.mkdirs(tmp); } catch (final Files.FileRuntimeException fre) { // ignored } } final File zipFile = new File(realLocation(zip)); final File extracted = new File(tmp, zipFile.getName().replace(".zip", "")); if (extracted.exists()) { return list(extracted); } else { Files.mkdirs(extracted); } Zips.unzip(zipFile, extracted); return list(extracted); }