mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-02 13:01:27 +12:00
Fix atomicity of savedata/trophy data writes
This commit is contained in:
parent
932f31e37b
commit
d4af8dd89a
3 changed files with 10 additions and 5 deletions
|
@ -748,7 +748,7 @@ namespace fs
|
|||
return result;
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
template <bool Flush = false, typename... Args>
|
||||
bool write_file(const std::string& path, bs_t<fs::open_mode> 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue