From 5c7f7eedec8d03d97091d51a624226dcebae4152 Mon Sep 17 00:00:00 2001 From: Gravit'a <12893402+gravit0@users.noreply.github.com> Date: Sun, 10 Mar 2024 15:49:01 +0700 Subject: [PATCH] [FIX] Possible problem with lwjgl --- .../gravit/launcher/base/api/ClientService.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/LauncherAPI/src/main/java/pro/gravit/launcher/base/api/ClientService.java b/LauncherAPI/src/main/java/pro/gravit/launcher/base/api/ClientService.java index 6228e8ea..4bcf9e88 100644 --- a/LauncherAPI/src/main/java/pro/gravit/launcher/base/api/ClientService.java +++ b/LauncherAPI/src/main/java/pro/gravit/launcher/base/api/ClientService.java @@ -14,6 +14,19 @@ public class ClientService { public static URL[] baseURLs; public static String findLibrary(String name) { - return nativePath.concat(IOHelper.PLATFORM_SEPARATOR).concat(JVMHelper.NATIVE_PREFIX).concat(name).concat(JVMHelper.NATIVE_EXTENSION); + if(name == null) { + return null; + } + var needExt = !name.endsWith(JVMHelper.NATIVE_EXTENSION); + var needPrefix = !name.startsWith(JVMHelper.NATIVE_PREFIX); + if(needExt && needPrefix) { + return nativePath.concat(IOHelper.PLATFORM_SEPARATOR).concat(JVMHelper.NATIVE_PREFIX).concat(name).concat(JVMHelper.NATIVE_EXTENSION); + } else if(needExt) { + return nativePath.concat(IOHelper.PLATFORM_SEPARATOR).concat(name).concat(JVMHelper.NATIVE_EXTENSION); + } else if(needPrefix) { + return nativePath.concat(IOHelper.PLATFORM_SEPARATOR).concat(JVMHelper.NATIVE_PREFIX).concat(name); + } else { + return nativePath.concat(IOHelper.PLATFORM_SEPARATOR).concat(name); + } } }