diff options
-rw-r--r-- | core/extension/gdextension.cpp | 6 | ||||
-rw-r--r-- | core/extension/gdextension.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp index 1e4cd81034..e39a531d0d 100644 --- a/core/extension/gdextension.cpp +++ b/core/extension/gdextension.cpp @@ -689,6 +689,12 @@ Ref<Resource> GDExtensionResourceLoader::load(const String &p_path, const String } if (err != OK) { +#if defined(WINDOWS_ENABLED) && defined(TOOLS_ENABLED) + // If the DLL fails to load, make sure that temporary DLL copies are cleaned up. + if (Engine::get_singleton()->is_editor_hint()) { + DirAccess::remove_absolute(lib->get_temp_library_path()); + } +#endif // Errors already logged in open_library() return Ref<Resource>(); } diff --git a/core/extension/gdextension.h b/core/extension/gdextension.h index 5a4dd3d5f5..5a0e39302b 100644 --- a/core/extension/gdextension.h +++ b/core/extension/gdextension.h @@ -81,6 +81,7 @@ public: #if defined(WINDOWS_ENABLED) && defined(TOOLS_ENABLED) void set_temp_library_path(const String &p_path) { temp_lib_path = p_path; } + String get_temp_library_path() const { return temp_lib_path; } #endif enum InitializationLevel { |