Exemplo n.º 1
0
  /**
   * Constructor
   *
   * @throws IOException
   */
  public JustAnotherPackageManager(Reporter reporter, Platform platform, File homeDir, File binDir)
      throws IOException {
    this.platform = platform;
    this.reporter = reporter;
    this.homeDir = homeDir;
    if (!homeDir.exists() && !homeDir.mkdirs())
      throw new IllegalArgumentException("Could not create directory " + homeDir);

    repoDir = IO.getFile(homeDir, "repo");
    if (!repoDir.exists() && !repoDir.mkdirs())
      throw new IllegalArgumentException("Could not create directory " + repoDir);

    commandDir = new File(homeDir, COMMANDS);
    serviceDir = new File(homeDir, SERVICE);
    commandDir.mkdir();
    serviceDir.mkdir();
    service = new File(repoDir, SERVICE_JAR_FILE);
    if (!service.isFile()) init();

    this.binDir = binDir;
    if (!binDir.exists() && !binDir.mkdirs())
      throw new IllegalArgumentException("Could not create bin directory " + binDir);
  }
Exemplo n.º 2
0
 /** This method will process each argument and assign new varibles */
 public void processArgs(String[] args) {
   Pattern pat = Pattern.compile("-[a-z]");
   for (int i = 0; i < args.length; i++) {
     String lcArg = args[i].toLowerCase();
     Matcher mat = pat.matcher(lcArg);
     if (mat.matches()) {
       char test = args[i].charAt(1);
       try {
         switch (test) {
           case 'f':
             fastas = IO.extractFiles(args[i + 1], "fasta");
             i++;
             break;
           case 'n':
             numberOfBases = Integer.parseInt(args[i + 1]);
             i++;
             break;
           case 'i':
             indexDirectory = new File(args[i + 1]);
             i++;
             break;
           case 'h':
             printDocs();
             System.exit(0);
           default:
             Misc.printExit("\nError: unknown option! " + mat.group());
         }
       } catch (Exception e) {
         Misc.printExit(
             "\nSorry, something doesn't look right with this parameter: -" + test + "\n");
       }
     }
   }
   // make index directory?
   if (indexDirectory == null) {
     indexDirectory = new File(fastas[0].getParentFile(), "IndexedSequences");
     indexDirectory.mkdir();
   }
 }