From 6554ccf86d1e563a1411474fb576ebb4079175c3 Mon Sep 17 00:00:00 2001 From: David Snopek Date: Tue, 12 Sep 2023 08:27:57 -0500 Subject: [PATCH] GDExtension: Delete left-over DLL copy before making a new copy --- core/extension/gdextension.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/extension/gdextension.cpp b/core/extension/gdextension.cpp index 96ad1570cd9a..3bc7dde10aea 100644 --- a/core/extension/gdextension.cpp +++ b/core/extension/gdextension.cpp @@ -711,6 +711,11 @@ Ref GDExtensionResourceLoader::load(const String &p_path, const String // This is so relative path to dependencies are satisfied. String copy_path = abs_path.get_base_dir().path_join("~" + abs_path.get_file()); + // If there's a left-over copy (possibly from a crash) then delete it first. + if (FileAccess::exists(copy_path)) { + DirAccess::remove_absolute(copy_path); + } + Error copy_err = DirAccess::copy_absolute(abs_path, copy_path); if (copy_err) { if (r_error) {