Add lib_loaded function to check for current loaded libraries

pull/882/head
Alessandro Toia 1 year ago
parent 1a3fa6e4ff
commit b61f83f522

@ -9,6 +9,9 @@
#include <cstring>
#include <string>
#include <spdlog/spdlog.h>
#include <filesystem.h>
namespace fs = ghc::filesystem;
std::string read_line(const std::string& filename)
{
@ -181,4 +184,18 @@ std::string get_config_dir()
return path;
}
bool lib_loaded(const std::string& lib) {
fs::path path("/proc/self/map_files/");
for (auto& p : fs::directory_iterator(path)) {
auto file = p.path().string();
auto sym = read_symlink(file.c_str());
if (sym.find(lib) != std::string::npos) {
return true;
break;
}
}
return false;
}
#endif // __linux__

@ -23,5 +23,6 @@ std::string get_wine_exe_name(bool keep_ext = false);
std::string get_home_dir();
std::string get_data_dir();
std::string get_config_dir();
bool lib_loaded(const std::string& lib);
#endif //MANGOHUD_FILE_UTILS_H

Loading…
Cancel
Save