예제 #1
0
파일: CSC1884.java 프로젝트: bitbay/csc1884
  /** 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);
  }
예제 #2
0
파일: CSC1884.java 프로젝트: bitbay/csc1884
 /** Deletes the working folder */
 private void cleanupWorkingFolder() {
   // cleanup temporary folder...
   FileUtils.deleteFolder(this.workingFolder);
 }