/** * Deletes a file, never throwing an exception. If file is a directory, * delete it and all sub-directories. * <p/> * The difference between File.delete() and this method are: * <ul> * <li>A directory to be deleted does not have to be empty.</li> * <li>No exceptions are thrown when a file or directory cannot be deleted. * </li> * </ul> * * @param file file or directory to delete, can be {@code null} */ public static void deleteQuietly(File file) { try { delete(file); } catch (Exception ignored) { // ignore } }
/** * Deletes a file, never throwing an exception. If file is a directory, * delete it and all sub-directories. * <p/> * The difference between File.delete() and this method are: * <ul> * <li>A directory to be deleted does not have to be empty.</li> * <li>No exceptions are thrown when a file or directory cannot be deleted. * </li> * </ul> * * @param file file or directory to delete, can be {@code null} */ public static void deleteQuietly(File file) { try { delete(file); } catch (Exception ignored) { // ignore } }
@Override public boolean delete(FileData data) { File file = new File(root, data.getName()); boolean deleted; try { FileUtils.delete(file); deleted = true; } catch (IOException e) { deleted = false; } // Delete empty parent folders while (!(file = file.getParentFile()).equals(root) && file.delete()); return deleted; }
delete(src); if (src.exists()) { throw new IOException(
public void deleteProjectHistory(String projectName) { try { String projectHistoryPath = studio.getSystemConfigManager() .getStringProperty(PROJECT_HISTORY_HOME) + File.separator + projectName; File dir = new File(projectHistoryPath); // Project can contain no history if (dir.exists()) { FileUtils.delete(dir); } } catch (Exception e) { String msg = "Failed to clean history of project '" + projectName + "'!"; log.error(msg, e); FacesUtils.addErrorMessage(msg, e.getMessage()); } }
for (File fl : files) { try { delete(fl); } catch (IOException ioe) { exception = ioe;
public void deleteProjectHistory(String projectName) { try { String projectHistoryPath = studio.getSystemConfigManager() .getStringProperty(PROJECT_HISTORY_HOME) + File.separator + projectName; File dir = new File(projectHistoryPath); // Project can contain no history if (dir.exists()) { FileUtils.delete(dir); } } catch (Exception e) { String msg = "Failed to clean history of project '" + projectName + "'!"; log.error(msg, e); FacesUtils.addErrorMessage(msg, e.getMessage()); } }
delete(src); if (src.exists()) { throw new IOException(
for (File fl : files) { try { delete(fl); } catch (IOException ioe) { exception = ioe;
try { String projectPath = getProjectHistoryHome() + File.separator + bean.getProjectName(); FileUtils.delete(new File(projectPath)); } catch (Exception e) { msg = "Failed to clean history of project '" + bean.getProjectName() + "'!";
try { String projectPath = getProjectHistoryHome() + File.separator + bean.getProjectName(); FileUtils.delete(new File(projectPath)); } catch (Exception e) { msg = "Failed to clean history of project '" + bean.getProjectName() + "'!";
if (outputDirectory.isDirectory()) { info("Cleaning up '", outputDirectory, "' directory..."); FileUtils.delete(outputDirectory);
if (outputDirectory.isDirectory()) { info("Cleaning up '", outputDirectory, "' directory..."); FileUtils.delete(outputDirectory);