diff --git a/Utilities/File.h b/Utilities/File.h index d39242bd80..0a23eb03e2 100644 --- a/Utilities/File.h +++ b/Utilities/File.h @@ -748,7 +748,7 @@ namespace fs return result; } - template + template bool write_file(const std::string& path, bs_t mode, const Args&... args) { // Always use write flag, remove read flag @@ -758,14 +758,19 @@ namespace fs { // Specialization for [const void*, usz] args f.write(args...); - return true; } else { // Write args sequentially (f.write(args), ...); - return true; } + + if constexpr (Flush) + { + f.sync(); + } + + return true; } return false; diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index addd5fa9c3..1a873e5756 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -1911,7 +1911,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v if (auto file = pair.second.release()) { auto fvec = static_cast>&>(*file); - fs::file(new_path + vfs::escape(pair.first), fs::rewrite).write(fvec.obj); + ensure(fs::write_file(new_path + vfs::escape(pair.first), fs::rewrite, fvec.obj)); } } diff --git a/rpcs3/Loader/TRP.cpp b/rpcs3/Loader/TRP.cpp index 97293121b2..36f80553ba 100644 --- a/rpcs3/Loader/TRP.cpp +++ b/rpcs3/Loader/TRP.cpp @@ -47,7 +47,7 @@ bool TRPLoader::Install(const std::string& dest, bool show) } // Create the file in the temporary directory - success = fs::write_file(temp + '/' + vfs::escape(entry.name), fs::create + fs::excl, buffer); + success = fs::write_file(temp + '/' + vfs::escape(entry.name), fs::create + fs::excl, buffer); if (!success) { break;