RMG-Core: improve handling of non-existent plugin files

This commit is contained in:
Rosalie Wanders committed 2024-06-29 22:25:46 +02:00
1 parent ce4321dcea
commit 147533ea45
1 file changed
+11 -2
+11 -2
View File
@@ -199,8 +199,7 @@ bool apply_plugin_settings(std::string pluginSettings[4])
{
pluginType = (CorePluginType)(i + 1);
settingValue = get_plugin_path(pluginType, pluginSettings[i]);
if (settingValue.empty() ||
!std::filesystem::is_regular_file(settingValue))
if (settingValue.empty())
{ // skip invalid setting value
continue;
}
@@ -230,6 +229,16 @@ bool apply_plugin_settings(std::string pluginSettings[4])
plugin->Unhook();
}
// ensure library file exists
if (!std::filesystem::is_regular_file(settingValue))
{
// force a re-load next time,
// because we've unhooked
// the existing one
l_PluginFiles[i].clear();
continue;
}
// attempt to open the library
handle = osal_dynlib_open(settingValue.c_str());
if (handle == nullptr)