public static File getAppData() {
    String userHomeDir = System.getProperty("user.home", ".");
    String osType = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);

    if (osType.contains("win") && System.getenv("APPDATA") != null) {
      return new File(new File(System.getenv("APPDATA")), ".minecraft");
    } else if (osType.contains("mac")) {
      return new File(new File(userHomeDir, "Library"), "Application Support");
    } else {
      return new File(new File(userHomeDir), ".minecraft");
    }
  }
  public void launch() {
    try {
      long time = System.nanoTime();
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

      monitor = new ProgressMonitor();
      monitor.setMaximum(5);

      updateState(BootstrapState.UPDATE_CHECK);
      {
        CountDownLatch latch = new CountDownLatch(2);
        runTask(TaskBootstrapUpdateCheck.class, latch);
        runTask(TaskInstallerUpdateCheck.class, latch);
        latch.await();
      }

      updateState(BootstrapState.LOAD_DEPENDENCIES);
      {
        runTask(TaskLoadDependencies.class);
      }

      updateState(BootstrapState.DOWNLOAD);
      {
        runTask(TaskDownload.class);
      }

      updateState(BootstrapState.SETUP_ENVIRONMENT);
      {
        runTask(TaskCheckJavaVersion.class);
        runTask(TaskBuildClasspath.class);
      }

      System.out.println(
          "Took " + ((System.nanoTime() - time) / 1000000f) + "ms to launch installer");
      updateState(BootstrapState.START_INSTALLER);
      {
        runTask(TaskLaunchInstaller.class);
      }

      updateState(BootstrapState.FINISHED);
    } catch (BootstrapException ex) {
      handleException(ex);
      System.exit(2);
    } catch (Exception ex) {
      handleException(ex);
      System.exit(-1);
    } finally {
      monitor.close();
    }
  }