From 7b1b9b86edf1fcc33f18ef947eb89a6e72f340c4 Mon Sep 17 00:00:00 2001 From: kobewi Date: Sun, 31 Mar 2024 13:53:36 +0200 Subject: [PATCH] Don't allow copying file into its own path --- core/io/dir_access.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/io/dir_access.cpp b/core/io/dir_access.cpp index 680a653dfc2..5a0679809ec 100644 --- a/core/io/dir_access.cpp +++ b/core/io/dir_access.cpp @@ -339,6 +339,8 @@ String DirAccess::get_full_path(const String &p_path, AccessType p_access) { } Error DirAccess::copy(const String &p_from, const String &p_to, int p_chmod_flags) { + ERR_FAIL_COND_V_MSG(p_from == p_to, ERR_INVALID_PARAMETER, "Source and destination path are equal."); + //printf("copy %s -> %s\n",p_from.ascii().get_data(),p_to.ascii().get_data()); Error err; {