(String cxxLibName, String rustLibName)
| 308 | } |
| 309 | |
| 310 | private static boolean tryLoadFromDistribution(String cxxLibName, String rustLibName) { |
| 311 | String libsDir = getNativeLibsDir(cxxLibName); |
| 312 | if (libsDir == null) { |
| 313 | return false; |
| 314 | } |
| 315 | |
| 316 | try { |
| 317 | // we are in a binary distribution, let's load libraries from the libs dir |
| 318 | System.load(Paths.get(libsDir, cxxLibName).toAbsolutePath().toString()); |
| 319 | System.load(Paths.get(libsDir, rustLibName).toAbsolutePath().toString()); |
| 320 | } catch (Throwable e) { |
| 321 | // if we fail to load distribution libraries, we will try to load them from the jar |
| 322 | System.err.println("Failed to load libraries from " + libsDir + ": " + e.getMessage()); |
| 323 | return false; |
| 324 | } |
| 325 | return true; |
| 326 | } |
| 327 | |
| 328 | static { |
| 329 | if ("aarch64".equals(System.getProperty("os.arch"))) { |
no test coverage detected