Merge pull request #2760 from Trial97/mangohid

fix mangohud detection for absolute path
This commit is contained in:
timoreo 2024-08-29 06:24:09 +02:00 committed by GitHub
commit 828acef7e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -108,24 +108,31 @@ QString getLibraryString()
if (filePath.isEmpty()) {
continue;
}
try {
auto conf = Json::requireDocument(filePath, vkLayer);
auto confObject = Json::requireObject(conf, vkLayer);
auto layer = Json::ensureObject(confObject, "layer");
QString libraryName = Json::ensureString(layer, "library_path");
if (libraryName.isEmpty()) {
continue;
}
if (QFileInfo(libraryName).isAbsolute()) {
return libraryName;
}
#ifdef __GLIBC__
// Check whether mangohud is usable on a glibc based system
if (!libraryName.isEmpty()) {
QString libraryPath = findLibrary(libraryName);
if (!libraryPath.isEmpty()) {
return libraryPath;
}
}
#else
// Without glibc return recorded shared library as-is.
return libraryName;
#endif
} catch (const Exception& e) {
}
}
return {};