From 147533ea453f72ff641fb77bbb0dfcc50daecace Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Sat, 29 Jun 2024 22:25:46 +0200 Subject: [PATCH] RMG-Core: improve handling of non-existent plugin files --- Source/RMG-Core/Plugins.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/RMG-Core/Plugins.cpp b/Source/RMG-Core/Plugins.cpp index 5386c471..3d225307 100644 --- a/Source/RMG-Core/Plugins.cpp +++ b/Source/RMG-Core/Plugins.cpp @@ -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)