Fixed crash with plugin loading (#102)

This commit is contained in:
Emma Miler 2022-03-06 19:39:01 +01:00 committed by GitHub
parent 13dcc7d930
commit 218f0d1435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -91,7 +91,11 @@ bool LoadPlugins()
std::vector<fs::path> paths;
std::string pluginPath = GetNorthstarPrefix() + "/plugins";
if (!fs::exists(pluginPath))
{
spdlog::warn("Could not find a plugins directory. Skipped loading plugins");
return false;
}
// ensure dirs exist
fs::recursive_directory_iterator iterator(pluginPath);
if (std::filesystem::begin(iterator) == std::filesystem::end(iterator))
@ -104,9 +108,7 @@ bool LoadPlugins()
if (fs::is_regular_file(entry) && entry.path().extension() == ".dll")
paths.emplace_back(entry.path().filename());
}
// system("pause");
initGameState();
// spdlog::info("Loading the following DLLs in plugins folder:");
for (fs::path path : paths)
{
std::string pathstring = (pluginPath / path).string();