Skip to content

Commit 35785d8

Browse files
committed
prepare NativeLibraryLoader for macOS
1 parent 2f53915 commit 35785d8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

objectbox-java/src/main/java/io/objectbox/internal/NativeLibraryLoader.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,21 @@ public class NativeLibraryLoader {
3838
// For Android, os.name is also "Linux", so we need an extra check
3939
boolean android = System.getProperty("java.vendor").contains("Android");
4040
if (!android) {
41-
String osName = System.getProperty("os.name");
41+
String osName = System.getProperty("os.name").toLowerCase();
4242
String sunArch = System.getProperty("sun.arch.data.model");
43-
if (osName.contains("Windows")) {
44-
libname += "-windows" + ("32".equals(sunArch) ? "-x86" : "-x64");
43+
String cpuArchPostfix = "32".equals(sunArch) ? "-x86" : "-x64";
44+
if (osName.contains("windows")) {
45+
libname += "-windows" + cpuArchPostfix;
4546
filename = libname + ".dll";
4647
checkUnpackLib(filename);
47-
} else if (osName.contains("Linux")) {
48-
libname += "-linux" + ("32".equals(sunArch) ? "-x86" : "-x64");
48+
} else if (osName.contains("linux")) {
49+
libname += "-linux" + cpuArchPostfix;
4950
filename = "lib" + libname + ".so";
5051
checkUnpackLib(filename);
52+
} else if (osName.contains("mac")) {
53+
libname += "-macos" + cpuArchPostfix;
54+
filename = "lib" + libname + ".dylib";
55+
checkUnpackLib(filename);
5156
}
5257
}
5358
File file = new File(filename);

0 commit comments

Comments
 (0)