addFolderToZip(file, baseFolderName, zip); addFileToZip(file, baseFolderName, zip);
/** * Attempt to recursively delete the specified file or folder. * * @param file a file representing the File or Folder to delete * * @return true if all files/folders have been deleted, false if only * partial removal occurred */ public static boolean recursiveDelete(File file) { if (file != null && file.exists()) { if (file.isDirectory()) { for (File child : file.listFiles()) { if (!recursiveDelete(child)) { return false; } } } return file.delete(); } else { return true; } }
/** * Create a {@link JacocoProfile} with the destination configured from System properties. * * @return a Jacoco profile with the destination configured from System properties */ public static JacocoProfile fromSystemProperty(String extraParams) { String sJacocoFolder = System.getProperty("jacoco.dest.folder"); boolean fEnabled = Boolean.getBoolean("jacoco.enabled"); if (sJacocoFolder == null || sJacocoFolder.trim().isEmpty()) { try { sJacocoFolder = FileHelper.createTemporaryFolder("jacoco").getCanonicalPath(); } catch (IOException e) { throw new RuntimeException(e); } } String jacocoFile = sJacocoFolder + "/" + UUID.randomUUID().toString() + ".exec"; String params = "destfile=" + jacocoFile; if (extraParams != null && !extraParams.trim().isEmpty()) { params = params + extraParams.trim(); } return new JacocoProfile(params, fEnabled); }
FileHelper.zip(Collections.singletonList(file), "", temporaryFile.getAbsolutePath());
addFolderToZip(file, baseFolderName, zip); addFileToZip(file, baseFolderName, zip);
/** * Attempt to recursively delete the specified file or folder. * * @param file a file representing the File or Folder to delete * * @return true if all files/folders have been deleted, false if only * partial removal occurred */ public static boolean recursiveDelete(File file) { if (file != null && file.exists()) { if (file.isDirectory()) { for (File child : file.listFiles()) { if (!recursiveDelete(child)) { return false; } } } return file.delete(); } else { return true; } }
addFolderToZip(file, parent + file.getName(), zip); addFileToZip(file, parentFolderName, zip);
addFolderToZip(file, parent + file.getName(), zip); addFileToZip(file, parentFolderName, zip);