private void doVerifyInstallation()

in plugin/src/main/java/com/attachme/plugin/AttachmeInstaller.java [30:59]


  private void doVerifyInstallation() throws IOException {
    List<String> files = new ArrayList<>();
    files.add(packedJarName());
    files.add("conf.sh");

    File installDir = getInstallDir();
    if (installDir.exists() && !installDir.isDirectory())
      throw new RuntimeException("A file under installation dir exists and is not a directory, please remove it " + installDir);
    if (!installDir.exists() && !installDir.mkdirs()) {
      throw new RuntimeException("Could not create installation dir " + installDir);
    }

    boolean installed = true;
    for (String file : files) {
      File f = new File(installDir, file);
      if (!f.exists()) {
        installed = false;
      } else if (!f.isFile()) {
        throw new RuntimeException("The file already exists, and is directory, please remove it " + f);
      }
    }

    if (!installed) {
      log.info("Exporting AttachMe JVM agent to " + installDir);
      for (String file : files) {
        exportFile(file, installDir);
      }
      printHelp();
    }
  }