MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / findLibrary

Function findLibrary

launcher/MangoHud.cpp:141–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141QString findLibrary(QString libName)
142{
143#ifdef __GLIBC__
144 const char* library = libName.toLocal8Bit().constData();
145
146 void* handle = dlopen(library, RTLD_NOW);
147 if (!handle) {
148 qCritical() << "dlopen() failed:" << dlerror();
149 return {};
150 }
151
152 char path[PATH_MAX];
153 if (dlinfo(handle, RTLD_DI_ORIGIN, path) == -1) {
154 qCritical() << "dlinfo() failed:" << dlerror();
155 dlclose(handle);
156 return {};
157 }
158
159 auto fullPath = FS::PathCombine(QString(path), libName);
160
161 dlclose(handle);
162 return fullPath;
163#else
164 qWarning() << "MangoHud::findLibrary is not implemented on this platform";
165 return {};
166#endif
167}
168} // namespace MangoHud
169
170#ifdef UNDEF_GNU_SOURCE

Callers 2

detectLibrariesMethod · 0.85
getLibraryStringFunction · 0.85

Calls 2

PathCombineFunction · 0.85
QStringClass · 0.85

Tested by

no test coverage detected