diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index 3f70e4f3b4..e3b82e80b4 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -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)