diff --git a/Source/Engine/Platform/Linux/LinuxFileSystem.cpp b/Source/Engine/Platform/Linux/LinuxFileSystem.cpp index d0d58f69c..54a4a492a 100644 --- a/Source/Engine/Platform/Linux/LinuxFileSystem.cpp +++ b/Source/Engine/Platform/Linux/LinuxFileSystem.cpp @@ -330,7 +330,22 @@ bool LinuxFileSystem::MoveFile(const StringView& dst, const StringView& src, boo return true; } - return rename(StringAsANSI<>(*src, src.Length()).Get(), StringAsANSI<>(*dst, dst.Length()).Get()) != 0; + if (overwrite) + { + unlink(StringAsANSI<>(*dst, dst.Length()).Get()); + } + if (rename(StringAsANSI<>(*src, src.Length()).Get(), StringAsANSI<>(*dst, dst.Length()).Get()) != 0) + { + if (errno == EXDEV) + { + if(!CopyFile(dst, src)) { + unlink(StringAsANSI<>(*src, src.Length()).Get()); + return false; + } + } + return true; + } + return false; } bool LinuxFileSystem::CopyFile(const StringView& dst, const StringView& src)