Skip to content

Commit aa1b558

Browse files
committed
Fix natives not being copied on some systems
Closes #934
1 parent a50ad91 commit aa1b558

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • common/src/main/java/dev/ryanhcode/sable/physics/impl/rapier

common/src/main/java/dev/ryanhcode/sable/physics/impl/rapier/Rapier3D.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ private static String getNativeName() {
5858
} else if (os == OS.OSX) {
5959
return LIB_NAME + "_" + arch + "_macos.dylib";
6060
} else {
61-
if (os != OS.LINUX)
61+
if (os != OS.LINUX) {
6262
Sable.LOGGER.error("Unknown platform '{}' detected, sable will attempt to use linux natives, this may or may not work.", System.getProperty("os.name"));
63+
}
6364
return LIB_NAME + "_" + arch + "_linux.so";
6465
}
6566
}
@@ -82,6 +83,9 @@ private static void loadLibrary() {
8283
while ((entry = ti.getNextEntry()) != null) {
8384
if (entry.getName().equals(NATIVE_NAME)) {
8485
final Path tempFile = dir.resolve(NATIVE_NAME);
86+
if (!Files.exists(tempFile)) {
87+
Files.createFile(tempFile);
88+
}
8589
Files.copy(ti, tempFile, StandardCopyOption.REPLACE_EXISTING);
8690
System.load(tempFile.toAbsolutePath().toString());
8791
return;

0 commit comments

Comments
 (0)