Skip to content

Commit

Permalink
Merge pull request PrismLauncher#2760 from Trial97/mangohid
Browse files Browse the repository at this point in the history
fix mangohud detection for absolute path
  • Loading branch information
timoreo22 authored Aug 29, 2024
2 parents 685519d + c64b7cd commit 828acef
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions launcher/MangoHud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,31 @@ QString getLibraryString()
if (filePath.isEmpty()) {
continue;
}

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");
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()) {
// Check whether mangohud is usable on a glibc based system
QString libraryPath = findLibrary(libraryName);
if (!libraryPath.isEmpty()) {
return libraryPath;
}
}
#else
// Without glibc return recorded shared library as-is.
return libraryName;
// Without glibc return recorded shared library as-is.
return libraryName;
#endif
} catch (const Exception& e) {
}
}

return {};
Expand Down

0 comments on commit 828acef

Please sign in to comment.