示例#1
0
文件: Control.java 项目: jnomani/HDD
  public static void main(String[] args) {

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, "Fatal Error Occurred!");
      System.exit(1);
    }

    /*View.SplashWindow s = new View.SplashWindow();

    s.setVisible(true);*/

    String fPath = args.length == 0 ? JOptionPane.showInputDialog("Enter source path") : args[0];
    File f = new File(fPath);
    if (!f.exists()) {
      System.out.println("Path does not exist!");
      System.exit(1);
    }

    String fDrive = fPath.substring(0, 3);
    File dFile = new File(fDrive);

    File[] dirs = Drive.getAllDrives();
    ArrayList<Drive> drives = new ArrayList<Drive>();

    for (int i = 0; i < dirs.length; i++) {

      if (!dirs[i].getPath().equals(dFile.getPath())) {
        System.out.println("Loading Drive " + dirs[i].getPath() + "...");
        drives.add(new Drive(dirs[i]));
      }
    }
    System.out.println("Done! Loading Interface...");
    // s.setVisible(false);

    Drive[] dr = new Drive[drives.size()];

    for (int i = 0; i < dr.length; i++) {
      dr[i] = drives.get(i);
    }
    new View(dr, f);
  }