From bfee541540f6351b5c572d723a50362f99df972c Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Sun, 7 Jun 2020 22:20:43 +0300 Subject: [PATCH] Atomically overwrite games.yml Reduce chances of losing information. --- rpcs3/Emu/System.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index fa15e33b92..c32eb6d229 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1202,7 +1202,8 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool games[m_title_id] = bdvd_dir; YAML::Emitter out; out << games; - fs::file(fs::get_config_dir() + "/games.yml", fs::rewrite).write(out.c_str(), out.size()); + fs::file(fs::get_config_dir() + "/_tmp_games.yml", fs::rewrite).write(out.c_str(), out.size()); + fs::rename(fs::get_config_dir() + "/_tmp_games.yml", fs::get_config_dir() + "/games.yml", true); } else if (m_cat == "1P" && from_hdd0_game) {