fix mangohud detection for absolute path

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2024-08-26 09:00:46 +03:00
parent 23c69e7f94
commit c64b7cd693
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

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