in src/com/pty4j/util/ExtractedNative.java [99:138]
private void doInit() throws IOException {
long startTimeNano = System.nanoTime();
Path destDir = getOrCreateDestDir();
if (LOG.isDebugEnabled()) {
LOG.debug("Found " + destDir + " in " + pastTime(startTimeNano));
}
List<Path> children;
try (Stream<Path> stream = Files.list(destDir)) {
children = stream.collect(Collectors.<Path>toList());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Listed files in " + pastTime(startTimeNano));
}
Map<String, Path> resourceToFileMap = new HashMap<>();
for (Path child : children) {
String resourceName = getResourceName(child.getFileName().toString());
resourceToFileMap.put(resourceName, child);
}
Set<String> bundledResourceNames = getBundledResourceNames();
boolean upToDate = isUpToDate(bundledResourceNames, resourceToFileMap);
if (LOG.isDebugEnabled()) {
LOG.debug("Checked upToDate in " + pastTime(startTimeNano));
}
if (!upToDate) {
for (Path child : children) {
Files.delete(child);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Cleared directory in " + pastTime(startTimeNano));
}
for (String bundledResourceName : bundledResourceNames) {
copy(bundledResourceName, destDir);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Copied " + bundledResourceNames + " in " + pastTime(startTimeNano));
}
}
myDestDir = destDir.toFile();
LOG.info("Extracted pty4j native in " + pastTime(startTimeNano));
}