mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
cellSaveData: try to handle occasional failures
Retry moving directory on FILE_ACCESS_ERROR
This commit is contained in:
parent
25aa5f80a6
commit
400718dfd9
1 changed files with 8 additions and 4 deletions
|
@ -927,15 +927,19 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
|||
fs::remove_all(old_path, false);
|
||||
|
||||
// Backup old savedata
|
||||
if (!fs::rename(dir_path, old_path, true))
|
||||
while (!fs::rename(dir_path, old_path, true))
|
||||
{
|
||||
fmt::throw_exception("Failed to move directory %s", dir_path);
|
||||
// Try to ignore access error in order to prevent spurious failure
|
||||
if (Emu.IsStopped() || fs::g_tls_error != fs::error::acces)
|
||||
fmt::throw_exception("Failed to move directory %s (%s)", dir_path, fs::g_tls_error);
|
||||
}
|
||||
|
||||
// Commit new savedata
|
||||
if (!fs::rename(new_path, dir_path, false))
|
||||
while (!fs::rename(new_path, dir_path, false))
|
||||
{
|
||||
fmt::throw_exception("Failed to move directory %s", new_path);
|
||||
// TODO: handle the case when only commit failed at the next save load
|
||||
if (Emu.IsStopped() || fs::g_tls_error != fs::error::acces)
|
||||
fmt::throw_exception("Failed to move directory %s (%s)", new_path, fs::g_tls_error);
|
||||
}
|
||||
|
||||
// Remove backup again (TODO: may be changed to persistent backup implementation)
|
||||
|
|
Loading…
Add table
Reference in a new issue