Skip to content

Commit 103f7f5

Browse files
authored
Merge pull request #82 from rucko24/fix/linux-cache-name
🐛 When the cacheName doesn't match the name of the downloaded JDK in Linux
2 parents f518afe + ea63639 commit 103f7f5

File tree

1 file changed

+3
-3
lines changed
  • dev.skidfuscator.obfuscator/src/main/java/dev/skidfuscator/obfuscator/util

1 file changed

+3
-3
lines changed

dev.skidfuscator.obfuscator/src/main/java/dev/skidfuscator/obfuscator/util/JdkDownloader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public class JdkDownloader {
1717
private static final String OS;
1818
private static final String JDK_URL;
1919
private static boolean jdkDownloaded = false;
20+
private static final String REGEX_TAR_GZ = ".tar.gz";
21+
public static final Path CACHE_DIR = Paths.get(System.getProperty("user.home"), ".ssvm", "jdk");
2022

2123
static {
2224
// handle for all os
@@ -40,14 +42,12 @@ public class JdkDownloader {
4042
}
4143
}
4244

43-
public static final Path CACHE_DIR = Paths.get(System.getProperty("user.home"), ".ssvm", "jdk");
44-
4545
public static Path getCachedJdk() throws IOException {
4646
String cacheName;
4747

4848
switch (OS) {
4949
case "linux":
50-
cacheName = "jdk-17.0.2";
50+
cacheName = Paths.get(JDK_URL).getFileName().toString().split(REGEX_TAR_GZ)[0];
5151
break;
5252
case "mac os x":
5353
case "mac":

0 commit comments

Comments
 (0)