diff --git a/src/common/file.cpp b/src/common/file.cpp index 80ec93dc6..90be6aa13 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -25,9 +25,6 @@ #ifdef CopyFile #undef CopyFile #endif -#ifdef MoveFile -#undef MoveFile -#endif #endif namespace Common { @@ -544,14 +541,14 @@ bool File::CopyFile(const std::filesystem::path& src, return SysFileCopyFile(src, dst); } -bool File::MoveFile(const std::filesystem::path& src, - const std::filesystem::path& dst) // @suppress("Member declaration not found") +bool File::RenameFile(const std::filesystem::path& src, + const std::filesystem::path& dst) // @suppress("Member declaration not found") { if (IsFileExisting(dst)) { DeleteFile(dst); // @suppress("Invalid arguments") } - return SysFileMoveFile(src, dst); + return SysFileRenameFile(src, dst); } void File::RemoveReadonly(const std::filesystem::path& name) { diff --git a/src/common/file.h b/src/common/file.h index bf95fca64..f5ebbe825 100644 --- a/src/common/file.h +++ b/src/common/file.h @@ -20,9 +20,6 @@ #ifdef CopyFile #undef CopyFile #endif -#ifdef MoveFile -#undef MoveFile -#endif #endif namespace Common { @@ -107,7 +104,7 @@ public: static std::vector FindFiles(const std::filesystem::path& path); static std::vector GetDirEntries(const std::filesystem::path& path); static bool CopyFile(const std::filesystem::path& src, const std::filesystem::path& dst); - static bool MoveFile(const std::filesystem::path& src, const std::filesystem::path& dst); + static bool RenameFile(const std::filesystem::path& src, const std::filesystem::path& dst); static void RemoveReadonly(const std::filesystem::path& name); KYTY_CLASS_NO_COPY(File); diff --git a/src/common/platform/sysFileIO.h b/src/common/platform/sysFileIO.h index 0ab47bbce..76974d133 100644 --- a/src/common/platform/sysFileIO.h +++ b/src/common/platform/sysFileIO.h @@ -80,7 +80,7 @@ void SysFileFindFiles(const std::filesystem::path& path, std::vector& out); bool SysFileCopyFile(const std::filesystem::path& src, const std::filesystem::path& dst); -bool SysFileMoveFile(const std::filesystem::path& src, const std::filesystem::path& dst); +bool SysFileRenameFile(const std::filesystem::path& src, const std::filesystem::path& dst); void SysFileRemoveReadonly(const std::filesystem::path& name); #endif /* KYTY_COMMON_PLATFORM_SYSFILEIO_H_ */ diff --git a/src/common/platform/sysLinuxFileIO.cpp b/src/common/platform/sysLinuxFileIO.cpp index 0a6ef8b02..e53e6a138 100644 --- a/src/common/platform/sysLinuxFileIO.cpp +++ b/src/common/platform/sysLinuxFileIO.cpp @@ -693,7 +693,7 @@ bool SysFileCopyFile(const std::filesystem::path& src, const std::filesystem::pa !error; } -bool SysFileMoveFile(const std::filesystem::path& src, const std::filesystem::path& dst) { +bool SysFileRenameFile(const std::filesystem::path& src, const std::filesystem::path& dst) { auto real_src = get_internal_name(src); auto real_dst = get_internal_name(dst); diff --git a/src/common/platform/sysWindowsFileIO.cpp b/src/common/platform/sysWindowsFileIO.cpp index b066a8255..a7cbb81e2 100644 --- a/src/common/platform/sysWindowsFileIO.cpp +++ b/src/common/platform/sysWindowsFileIO.cpp @@ -565,7 +565,7 @@ bool SysFileCopyFile(const std::filesystem::path& src, const std::filesystem::pa return CopyFileW(src_wide.c_str(), dst_wide.c_str(), FALSE) != 0; } -bool SysFileMoveFile(const std::filesystem::path& src, const std::filesystem::path& dst) { +bool SysFileRenameFile(const std::filesystem::path& src, const std::filesystem::path& dst) { auto src_wide = src.wstring(); auto dst_wide = dst.wstring(); return MoveFileW(src_wide.c_str(), dst_wide.c_str()) != 0; diff --git a/src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp b/src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp index 6ba62ba65..60461c05f 100644 --- a/src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp +++ b/src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp @@ -327,7 +327,7 @@ void PipelineCache::Save() { const bool flushed = !file.IsInvalid() && file.Flush(); file.Close(); if (prefix_written != prefix.size() || payload_written != payload.size() || !flushed || - !Common::File::MoveFile(temp_path, m_driver_cache_path)) { + !Common::File::RenameFile(temp_path, m_driver_cache_path)) { PipelineCacheLog("Vulkan pipeline cache: failed to write {}", Common::PathToString(m_driver_cache_path)); return; diff --git a/src/kernel/fileSystem.cpp b/src/kernel/fileSystem.cpp index be91483ea..7a5c63630 100644 --- a/src/kernel/fileSystem.cpp +++ b/src/kernel/fileSystem.cpp @@ -1066,7 +1066,7 @@ int KYTY_SYSV_ABI KernelRename(const char* from, const char* to) { Common::File::DeleteFile(real_to); } - if (!Common::File::MoveFile(real_from, real_to)) { + if (!Common::File::RenameFile(real_from, real_to)) { return KERNEL_ERROR_EIO; }