From 78617129d0be8d4472f1cad029355b91f8837229 Mon Sep 17 00:00:00 2001 From: cssxsh Date: Sun, 10 Sep 2023 11:02:17 +0800 Subject: [PATCH] fix: native path --- .../io/github/kasukusakura/silkcodec/NativeLoader.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/kasukusakura/silkcodec/NativeLoader.java b/src/main/java/io/github/kasukusakura/silkcodec/NativeLoader.java index ed8caf6..c22edec 100644 --- a/src/main/java/io/github/kasukusakura/silkcodec/NativeLoader.java +++ b/src/main/java/io/github/kasukusakura/silkcodec/NativeLoader.java @@ -86,8 +86,12 @@ private static void init0(File tmpdir) throws Throwable { } String nt = settings.getProperty("native.path"); if (nt != null) { - System.load(nt); - return; + try { + System.load(nt); + return; + } catch (UnsatisfiedLinkError ignored) { + // 忽略 native.path 不可读 (文件有迁移或者其他情况时) + } } } String os = System.getProperty("os.name").toLowerCase(Locale.ROOT);