fix: only add native library overrides if files exist

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-08-02 13:56:23 +02:00
parent b927e58126
commit c2d6a137ab
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951

View File

@ -397,22 +397,25 @@ QStringList MinecraftInstance::extraArguments()
QString glfwPath;
if (settings()->get("UseNativeOpenAL").toBool()) {
auto customPath = settings()->get("CustomOpenALPath").toString();
openALPath = APPLICATION->m_detectedOpenALPath;
auto customPath = settings()->get("CustomOpenALPath").toString();
if (!customPath.isEmpty())
openALPath = customPath;
}
if (settings()->get("UseNativeGLFW").toBool()) {
auto customPath = settings()->get("CustomGLFWPath").toString();
glfwPath = APPLICATION->m_detectedGLFWPath;
auto customPath = settings()->get("CustomGLFWPath").toString();
if (!customPath.isEmpty())
glfwPath = customPath;
}
if (!openALPath.isEmpty())
list.append("-Dorg.lwjgl.openal.libname=" + openALPath);
if (!glfwPath.isEmpty())
list.append("-Dorg.lwjgl.glfw.libname=" + glfwPath);
QFileInfo openALInfo(openALPath);
QFileInfo glfwInfo(glfwPath);
if (!openALPath.isEmpty() && openALInfo.exists())
list.append("-Dorg.lwjgl.openal.libname=" + openALInfo.absoluteFilePath());
if (!glfwPath.isEmpty() && glfwInfo.exists())
list.append("-Dorg.lwjgl.glfw.libname=" + glfwInfo.absoluteFilePath());
}
return list;