Skip to content

Commit 0357eef

Browse files
committed
Workaround os.arch reporting inconsistency on MacOS
The normal JVM returns `x86_64` but Graal AOT returns `amd64`. Addresses #336
1 parent c981e9a commit 0357eef

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/com/github/luben/zstd/util/Native.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ private static String osName() {
3131
}
3232
}
3333

34-
private static String osArch() {
35-
return System.getProperty("os.arch");
36-
}
37-
3834
private static String libExtension() {
3935
if (osName().contains("os_x") || osName().contains("darwin")) {
4036
return "dylib";
@@ -46,7 +42,12 @@ private static String libExtension() {
4642
}
4743

4844
private static String resourceName() {
49-
return "/" + osName() + "/" + osArch() + "/" + libname + "." + libExtension();
45+
String os = osName();
46+
String arch = System.getProperty("os.arch");
47+
if (os.equals("darwin") && arch.equals("amd64")) {
48+
arch = "x86_64";
49+
}
50+
return "/" + os + "/" + arch + "/" + libname + "." + libExtension();
5051
}
5152

5253
private static AtomicBoolean loaded = new AtomicBoolean(false);

0 commit comments

Comments
 (0)