Skip to content

Commit

Permalink
Workaround os.arch reporting inconsistency on MacOS
Browse files Browse the repository at this point in the history
The normal JVM returns `x86_64` but Graal AOT returns `amd64`.

Addresses #336
  • Loading branch information
luben committed Jan 1, 2025
1 parent c981e9a commit 0357eef
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/com/github/luben/zstd/util/Native.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ private static String osName() {
}
}

private static String osArch() {
return System.getProperty("os.arch");
}

private static String libExtension() {
if (osName().contains("os_x") || osName().contains("darwin")) {
return "dylib";
Expand All @@ -46,7 +42,12 @@ private static String libExtension() {
}

private static String resourceName() {
return "/" + osName() + "/" + osArch() + "/" + libname + "." + libExtension();
String os = osName();
String arch = System.getProperty("os.arch");
if (os.equals("darwin") && arch.equals("amd64")) {
arch = "x86_64";
}
return "/" + os + "/" + arch + "/" + libname + "." + libExtension();
}

private static AtomicBoolean loaded = new AtomicBoolean(false);
Expand Down

0 comments on commit 0357eef

Please sign in to comment.