/** * <p> * Delete the specified {@link File} instance from the filesystem. If the instance is a directory it will be deleted * recursively, otherwise only the file will be deleted. * </p> * * @param file */ public static void delete(File file) { if (file.exists()) { if (file.isDirectory()) { String[] childs = file.list(); for (String childName : childs) { File child = new File(file.getPath() + File.separator + childName); delete(child); } file.delete(); } else { file.delete(); } } }
/** * <p> * Delete the specified {@link File} instance from the filesystem. If the instance is a directory it will be deleted * recursively, otherwise only the file will be deleted. * </p> * * @param file */ public static void delete(File file) { if (file.exists()) { if (file.isDirectory()) { String[] childs = file.list(); for (String childName : childs) { File child = new File(file.getPath() + File.separator + childName); delete(child); } file.delete(); } else { file.delete(); } } }
/** * <p> * Initializes the working directory. * </p> * * @return */ private void initWorkingDirectory() { String workingDir = getWorkingDir(); File workingDirectoryFile = new File(workingDir); if (workingDirectoryFile.exists()) { if (this.configuration.isAlwaysCreateFiles()) { FILE_STORE_LOGGER.fileConfigAlwaysCreateWorkingDir(workingDirectoryFile.getPath()); delete(workingDirectoryFile); } } workingDirectoryFile.mkdirs(); FILE_STORE_LOGGER.fileConfigUsingWorkingDir(workingDirectoryFile.getPath()); }
/** * <p> * Initializes the working directory. * </p> * * @return */ private void initWorkingDirectory() { String workingDir = getWorkingDir(); File workingDirectoryFile = new File(workingDir); if (workingDirectoryFile.exists()) { if (this.configuration.isAlwaysCreateFiles()) { FILE_STORE_LOGGER.fileConfigAlwaysCreateWorkingDir(workingDirectoryFile.getPath()); delete(workingDirectoryFile); } } workingDirectoryFile.mkdirs(); FILE_STORE_LOGGER.fileConfigUsingWorkingDir(workingDirectoryFile.getPath()); }