From 762de1752665776750b424445547e717e6dc467c Mon Sep 17 00:00:00 2001 From: Deficuet <36525579+Deficuet@users.noreply.github.com> Date: Sat, 11 Jun 2022 23:26:52 -0600 Subject: [PATCH] fix exception when load dll --- .../io/github/deficuet/unitykt/util/NativeUtils.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/io/github/deficuet/unitykt/util/NativeUtils.kt b/src/main/kotlin/io/github/deficuet/unitykt/util/NativeUtils.kt index c70040ef..b935c5ea 100644 --- a/src/main/kotlin/io/github/deficuet/unitykt/util/NativeUtils.kt +++ b/src/main/kotlin/io/github/deficuet/unitykt/util/NativeUtils.kt @@ -40,11 +40,13 @@ class NativeUtils private constructor() { try { System.load(tempFile.absolutePath) } finally { - if (isPosix) { - tempFile.delete() - } else { - tempFile.deleteOnExit() - } + try { + if (isPosix) { + tempFile.delete() + } else { + tempFile.deleteOnExit() + } + } catch (_: Throwable) { } } } }