build: Remove all static variables from headers to hopefully fix plugins

This commit is contained in:
WerWolv
2023-07-26 13:50:51 +02:00
parent 866c87b2bf
commit 27c8e19c14
31 changed files with 236 additions and 225 deletions

View File

@@ -108,29 +108,6 @@ namespace hex::init {
bool setupEnvironment() {
hex::log::debug("Using romfs: '{}'", romfs::name());
// Load the SSL certificate
constexpr static auto CaCertFileName = "cacert.pem";
// Look for a custom certificate in the config folder
std::fs::path caCertPath;
for (const auto &folder : fs::getDefaultPaths(fs::ImHexPath::Config)) {
for (const auto &file : std::fs::directory_iterator(folder)) {
if (file.path().filename() == CaCertFileName) {
caCertPath = file.path();
break;
}
}
}
// If a custom certificate was found, use it, otherwise use the one from the romfs
std::string caCertData;
if (!caCertPath.empty())
caCertData = wolv::io::File(caCertPath, wolv::io::File::Mode::Read).readString();
else
caCertData = std::string(romfs::get(CaCertFileName).string());
HttpRequest::setCACert(caCertData);
return true;
}