public File getDirectory() {
    String applicationName = xSettings.mineFolder;
    String userHome = System.getProperty("user.home", ".");
    File workingDirectory;
    switch (getPlatform().ordinal()) {
    case 0:
    case 1:
      workingDirectory = new File(userHome, '.' + applicationName + '/');
      break;
    case 2:
      String applicationData = System.getenv("APPDATA");
      if (applicationData != null) {
        workingDirectory = new File(applicationData, "." + applicationName + '/');
      } else {
        workingDirectory = new File(userHome, '.' + applicationName + '/');
      }
      break;
    case 3:
      workingDirectory = new File(userHome, "Library/Application Support/" + applicationName);
      break;
    default:
      workingDirectory = new File(userHome, applicationName + '/');
    }
    if ((!workingDirectory.exists()) && (!workingDirectory.mkdirs())){
      throw new RuntimeException("The working directory could not be created: " + workingDirectory);
    }
    return workingDirectory;
  }