This commit is contained in:
2025-03-18 00:15:42 -05:00
parent 59e85e9006
commit aa19e97fa8

View File

@@ -47,28 +47,31 @@ bool App::load(std::string lib, std::list<std::string> blacklist = {}) {
Module* m = create(h, App::Get()); Module* m = create(h, App::Get());
for(auto it = blacklist.begin(); it != blacklist.end(); it++) { if(!blacklist.empty()) {
if(*it == m->getName()) { for(auto it = blacklist.begin(); it != blacklist.end(); it++) {
std::cout << "Module \"" << *it << "\" is already loaded!\n"; if(*it == m->getName()) {
delete m; std::cout << "Module \"" << *it << "\" is already loaded!\n";
dlclose(h); delete m;
return false; dlclose(h);
return false;
}
} }
} }
blacklist.push_back(m->getName()); blacklist.push_back(m->getName());
bool skip = false; if(!m->deps.empty()) {
bool skip = false;
for(auto s = blacklist.begin(); s != blacklist.end(); s++) { for(auto s = blacklist.begin(); s != blacklist.end(); s++) {
auto it = m->deps.find(*s); auto it = m->deps.find(*s);
if(it != m->deps.end()) if(it != m->deps.end())
skip = true; skip = true;
if(skip) { if(skip) {
skip = false; skip = false;
continue; continue;
} else { } else {
load(it->second, blacklist); load(it->second, blacklist);
}
} }
} }