Skip to content

Commit

Permalink
Merge pull request #80720 from dsnopek/gdextension-dll-copy-error
Browse files Browse the repository at this point in the history
GDExtension: Remove DLL copy if it fails to load
  • Loading branch information
akien-mga committed Aug 17, 2023
2 parents 0511f9d + 908b8c0 commit 5dc7e23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/extension/gdextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
}
Expand Down
1 change: 1 addition & 0 deletions core/extension/gdextension.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class GDExtension : public Resource {

#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 {
Expand Down

0 comments on commit 5dc7e23

Please sign in to comment.