From 622cb211563f103c60099301069300cd55dc55eb Mon Sep 17 00:00:00 2001 From: Will Hedgecock Date: Tue, 18 Jan 2022 00:04:28 -0600 Subject: [PATCH] Allow loading of OpenBSD native libraries --- .../com/fazecast/jSerialComm/SerialPort.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/fazecast/jSerialComm/SerialPort.java b/src/main/java/com/fazecast/jSerialComm/SerialPort.java index 8b49a47..2cb0f88 100644 --- a/src/main/java/com/fazecast/jSerialComm/SerialPort.java +++ b/src/main/java/com/fazecast/jSerialComm/SerialPort.java @@ -160,17 +160,34 @@ public final class SerialPort } fileName = "libjSerialComm.so"; } - else if (OS.indexOf("bsd") >= 0) + else if (OS.indexOf("freebsd") >= 0) { if (arch.equals("aarch64") || arch.equals("arm64")) libraryPath = "FreeBSD/arm64"; - if (arch.indexOf("64") >= 0) + else if (arch.indexOf("64") >= 0) { libraryPath = "FreeBSD/x86_64"; backupLibraryPath = "FreeBSD/x86"; } else + { libraryPath = "FreeBSD/x86"; + backupLibraryPath = "FreeBSD/x86_64"; + } + fileName = "libjSerialComm.so"; + } + else if (OS.indexOf("openbsd") >= 0) + { + if (arch.indexOf("64") >= 0) + { + libraryPath = "OpenBSD/amd64"; + backupLibraryPath = "OpenBSD/x86"; + } + else + { + libraryPath = "OpenBSD/x86"; + backupLibraryPath = "OpenBSD/amd64"; + } fileName = "libjSerialComm.so"; } else if ((OS.indexOf("nix") >= 0) || (OS.indexOf("nux") >= 0))