in src/com/pty4j/util/ExtractedNative.java [141:164]
private Path getOrCreateDestDir() throws IOException {
String staticParentDirPath = System.getProperty("pty4j.tmpdir");
String prefix = "pty4j-" + myResourceOsArchSubPath.replace('/', '-');
if (staticParentDirPath != null && !staticParentDirPath.trim().isEmpty()) {
// It's assumed that "pty4j.tmpdir" directory should not be used by several processes with pty4j simultaneously.
// And several pty4j.jar versions can't coexist in classpath of a process.
Path staticParentDir = Paths.get(staticParentDirPath);
if (staticParentDir.isAbsolute()) {
Path staticDir = staticParentDir.resolve(prefix);
if (Files.isDirectory(staticDir)) {
return staticDir;
}
if (Files.isDirectory(staticParentDir)) {
if (Files.exists(staticDir)) {
Files.delete(staticDir);
}
return Files.createDirectory(staticDir);
}
}
}
Path tempDirectory = Files.createTempDirectory(prefix + "-");
tempDirectory.toFile().deleteOnExit();
return tempDirectory;
}