/** Create the working folder (later deleted) */ private void createWorkingFolder() throws RuntimeException { if (this.workingFolder == null && (this.workingFolderPath == null || this.workingFolderPath.equals(""))) throw new RuntimeException("Class needs a valid working folder!"); if (this.workingFolder == null) { this.workingFolder = new File(this.workingFolderPath); } else { // sanitize working folder. If it exists and is a directory, delete // it. If it is a file, refuse to continue. if (this.workingFolder.exists()) { if (this.workingFolder.isFile()) { throw new RuntimeException("Working folder exists, and is a file!"); } if (this.workingFolder.isDirectory()) { Logger.log("Deleting existing working directory."); FileUtils.deleteFolder(this.workingFolder); } } } // create temporary directory for the local repository... this.workingFolder = FileUtils.createFolder(this.workingFolder); }
/** Deletes the working folder */ private void cleanupWorkingFolder() { // cleanup temporary folder... FileUtils.deleteFolder(this.workingFolder); }