Exemplo n.º 1
0
    private void addFile(String file, boolean warn) {
      if (contains(file)) {
        /* Discard duplicates and avoid infinite recursion */
        return;
      }

      File ele = new File(file);
      if (!ele.exists()) {
        /* No such file or directory exist */
        if (warn)
          //                      log.warning(Position.NOPOS,
          //                          "path.element.not.found", file);
          return;
      }

      if (ele.isFile()) {
        /* File is an ordinay file  */
        String arcname = file.toLowerCase();
        if (!(arcname.endsWith(".zip") || arcname.endsWith(".jar"))) {
          /* File name don't have right extension */
          //                      if (warn)
          //                          log.warning(Position.NOPOS,
          //                              "invalid.archive.file", file);
          return;
        }
      }

      /* Now what we have left is either a directory or a file name
      confirming to archive naming convention */

      super.add(file);
      if (expandJarClassPaths && isZip(file)) addJarClassPath(file, warn);
    }
Exemplo n.º 2
0
 /**
  * Delete all the generated source files made during the execution of this environment (those that
  * have been registered with the "addGeneratedFile" method).
  */
 public void deleteGeneratedFiles() {
   synchronized (generatedFiles) {
     Enumeration<File> enumeration = generatedFiles.elements();
     while (enumeration.hasMoreElements()) {
       File file = enumeration.nextElement();
       file.delete();
     }
     generatedFiles.removeAllElements();
   }
 }