From ac6526b7314157a6b0a21c554139413c03b44337 Mon Sep 17 00:00:00 2001 From: InviseDivine <92590086+InviseDivine@users.noreply.github.com> Date: Sat, 13 Jun 2026 09:18:41 +0200 Subject: [PATCH] [rcore] Fix ``FileCopy`` doesn't copy file when directory exists (#5920) * Fix FileCopy result * fix code style --- src/rcore.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rcore.c b/src/rcore.c index 137dd99ce..fde64229d 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -2237,8 +2237,14 @@ int FileCopy(const char *srcPath, const char *dstPath) unsigned char *srcFileData = LoadFileData(srcPath, &srcDataSize); // Create required paths if they do not exist - if (!DirectoryExists(GetDirectoryPath(dstPath))) + if (DirectoryExists(GetDirectoryPath(dstPath))) + { + result = 0; + } + else + { result = MakeDirectory(GetDirectoryPath(dstPath)); + } if (result == 0) // Directory created successfully (or already exists) {