Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavo committed Oct 5, 2023
1 parent a556b4a commit d8213a8
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/main/java/org/fusesource/jansi/internal/JansiLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
Expand Down Expand Up @@ -122,11 +121,9 @@ private static File getTempDir() {
* on VM-Exit (bug #80)
*/
static void cleanup() {
String tempFolder = getTempDir().getAbsolutePath();
File dir = new File(tempFolder);

String filePrefix = "jansi-" + getVersion();
File[] nativeLibFiles = dir.listFiles((dir1, name) -> name.startsWith(filePrefix) && !name.endsWith(".lck"));
File[] nativeLibFiles =
getTempDir().listFiles((dir1, name) -> name.startsWith(filePrefix) && !name.endsWith(".lck"));
if (nativeLibFiles != null) {
for (File nativeLibFile : nativeLibFiles) {
File lckFile = new File(nativeLibFile.getAbsolutePath() + ".lck");
Expand Down Expand Up @@ -378,14 +375,11 @@ public static int getMinorVersion() {
* @return The version of the jansi library.
*/
public static String getVersion() {

URL versionFile = JansiLoader.class.getResource("/org/fusesource/jansi/jansi.properties");

String version = "unknown";
try {
if (versionFile != null) {
try (InputStream stream = JansiLoader.class.getResourceAsStream("/org/fusesource/jansi/jansi.properties")) {
if (stream != null) {
Properties versionData = new Properties();
versionData.load(versionFile.openStream());
versionData.load(stream);
version = versionData.getProperty("version", version);
version = version.trim().replaceAll("[^0-9.]", "");
}
Expand Down

0 comments on commit d8213a8

Please sign in to comment.