1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Implement fs::sync (Linux/POSIX)

This commit is contained in:
Nekotekina 2021-02-23 13:09:20 +03:00
parent 014846cf31
commit 090a769bf6
3 changed files with 14 additions and 0 deletions

View File

@ -946,6 +946,16 @@ bool fs::utime(const std::string& path, s64 atime, s64 mtime)
#endif #endif
} }
void fs::sync()
{
#ifdef _WIN32
fs::g_tls_error = fs::error::unknown;
#else
::sync();
fs::g_tls_error = fs::error::ok;
#endif
}
[[noreturn]] void fs::xnull(const src_loc& loc) [[noreturn]] void fs::xnull(const src_loc& loc)
{ {
fmt::throw_exception("Null object.%s", loc); fmt::throw_exception("Null object.%s", loc);

View File

@ -193,6 +193,9 @@ namespace fs
// Set file access/modification time // Set file access/modification time
bool utime(const std::string& path, s64 atime, s64 mtime); bool utime(const std::string& path, s64 atime, s64 mtime);
// Synchronize filesystems (TODO)
void sync();
class file final class file final
{ {
std::unique_ptr<file_base> m_file; std::unique_ptr<file_base> m_file;

View File

@ -1929,6 +1929,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
// Remove old backup // Remove old backup
fs::remove_all(old_path); fs::remove_all(old_path);
fs::sync();
// Backup old savedata // Backup old savedata
if (!vfs::host::rename(dir_path, old_path, &g_mp_sys_dev_hdd0, false)) if (!vfs::host::rename(dir_path, old_path, &g_mp_sys_dev_hdd0, false))