private void copy()

in src/com/pty4j/util/ExtractedNative.java [220:236]


  private void copy(@NotNull String resourceName, @NotNull Path destDir) throws IOException {
    URL url = getBundledResourceUrl(resourceName);
    int lastNameInd = resourceName.lastIndexOf('/');
    String name = lastNameInd != -1 ? resourceName.substring(lastNameInd + 1) : resourceName;
    InputStream inputStream = url.openStream();
    //noinspection TryFinallyCanBeTryWithResources
    try {
      Path destFile = destDir.resolve(name);
      Files.copy(inputStream, destFile);
      if (shouldBePosixExecutable(resourceName)) {
        Files.setPosixFilePermissions(destFile, Set.of(PosixFilePermission.OWNER_EXECUTE, PosixFilePermission.OWNER_READ));
      }
    }
    finally {
      inputStream.close();
    }
  }